Always show all reaction choosers in private chats.
This commit is contained in:
parent
534f17e784
commit
cef7ca17f3
@ -433,16 +433,33 @@ void MessageReaction::set_is_chosen(bool is_chosen, DialogId chooser_dialog_id,
|
||||
}
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::messageReaction> MessageReaction::get_message_reaction_object(Td *td) const {
|
||||
td_api::object_ptr<td_api::messageReaction> MessageReaction::get_message_reaction_object(Td *td, UserId my_user_id,
|
||||
UserId peer_user_id) const {
|
||||
CHECK(!is_empty());
|
||||
|
||||
vector<td_api::object_ptr<td_api::MessageSender>> recent_choosers;
|
||||
for (auto dialog_id : recent_chooser_dialog_ids_) {
|
||||
auto recent_chooser = get_min_message_sender_object(td, dialog_id, "get_message_reaction_object");
|
||||
if (recent_chooser != nullptr) {
|
||||
recent_choosers.push_back(std::move(recent_chooser));
|
||||
if (recent_choosers.size() == MAX_RECENT_CHOOSERS) {
|
||||
break;
|
||||
if (my_user_id.is_valid()) {
|
||||
CHECK(peer_user_id.is_valid());
|
||||
if (is_chosen()) {
|
||||
auto recent_chooser = get_min_message_sender_object(td, DialogId(my_user_id), "get_message_reaction_object");
|
||||
if (recent_chooser != nullptr) {
|
||||
recent_choosers.push_back(std::move(recent_chooser));
|
||||
}
|
||||
}
|
||||
if (choose_count_ >= (is_chosen() ? 2 : 1)) {
|
||||
auto recent_chooser = get_min_message_sender_object(td, DialogId(peer_user_id), "get_message_reaction_object");
|
||||
if (recent_chooser != nullptr) {
|
||||
recent_choosers.push_back(std::move(recent_chooser));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto dialog_id : recent_chooser_dialog_ids_) {
|
||||
auto recent_chooser = get_min_message_sender_object(td, dialog_id, "get_message_reaction_object");
|
||||
if (recent_chooser != nullptr) {
|
||||
recent_choosers.push_back(std::move(recent_chooser));
|
||||
if (recent_choosers.size() == MAX_RECENT_CHOOSERS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,8 @@ class MessageReaction {
|
||||
return recent_chooser_min_channels_;
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::messageReaction> get_message_reaction_object(Td *td) const;
|
||||
td_api::object_ptr<td_api::messageReaction> get_message_reaction_object(Td *td, UserId my_user_id,
|
||||
UserId peer_user_id) const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
|
@ -6961,8 +6961,14 @@ td_api::object_ptr<td_api::messageInteractionInfo> MessagesManager::get_message_
|
||||
|
||||
vector<td_api::object_ptr<td_api::messageReaction>> reactions;
|
||||
if (has_reactions) {
|
||||
reactions = transform(m->reactions->reactions_, [td = td_](const MessageReaction &reaction) {
|
||||
return reaction.get_message_reaction_object(td);
|
||||
UserId my_user_id;
|
||||
UserId peer_user_id;
|
||||
if (dialog_id.get_type() == DialogType::User) {
|
||||
my_user_id = td_->contacts_manager_->get_my_id();
|
||||
peer_user_id = dialog_id.get_user_id();
|
||||
}
|
||||
reactions = transform(m->reactions->reactions_, [td = td_, my_user_id, peer_user_id](const MessageReaction &reaction) {
|
||||
return reaction.get_message_reaction_object(td, my_user_id, peer_user_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user