Add MessageReactions::get_chosen_reactions.
This commit is contained in:
parent
e07ab8e71a
commit
2ee994aed1
@ -699,6 +699,20 @@ void MessageReactions::fix_chosen_reaction(DialogId my_dialog_id) {
|
||||
}
|
||||
}
|
||||
|
||||
vector<string> MessageReactions::get_chosen_reactions() const {
|
||||
if (!chosen_reaction_order_.empty()) {
|
||||
return chosen_reaction_order_;
|
||||
}
|
||||
|
||||
vector<string> reaction_order;
|
||||
for (auto &reaction : reactions_) {
|
||||
if (reaction.is_chosen()) {
|
||||
reaction_order.push_back(reaction.get_reaction());
|
||||
}
|
||||
}
|
||||
return reaction_order;
|
||||
}
|
||||
|
||||
bool MessageReactions::need_update_message_reactions(const MessageReactions *old_reactions,
|
||||
const MessageReactions *new_reactions) {
|
||||
if (old_reactions == nullptr) {
|
||||
|
@ -161,6 +161,8 @@ struct MessageReactions {
|
||||
|
||||
void fix_chosen_reaction(DialogId my_dialog_id);
|
||||
|
||||
vector<string> get_chosen_reactions() const;
|
||||
|
||||
static bool need_update_message_reactions(const MessageReactions *old_reactions,
|
||||
const MessageReactions *new_reactions);
|
||||
|
||||
|
@ -24589,13 +24589,6 @@ void MessagesManager::set_message_reactions(Dialog *d, Message *m, bool is_big,
|
||||
CHECK(m->reactions != nullptr);
|
||||
m->reactions->sort_reactions(active_reaction_pos_);
|
||||
|
||||
vector<string> reactions;
|
||||
for (auto &reaction : m->reactions->reactions_) {
|
||||
if (reaction.is_chosen()) {
|
||||
reactions.push_back(reaction.get_reaction());
|
||||
}
|
||||
}
|
||||
|
||||
FullMessageId full_message_id{d->dialog_id, m->message_id};
|
||||
pending_reactions_[full_message_id].query_count++;
|
||||
|
||||
@ -24608,7 +24601,8 @@ void MessagesManager::set_message_reactions(Dialog *d, Message *m, bool is_big,
|
||||
send_closure(actor_id, &MessagesManager::on_set_message_reactions, full_message_id, std::move(result),
|
||||
std::move(promise));
|
||||
});
|
||||
send_message_reaction(td_, full_message_id, std::move(reactions), is_big, add_to_recent, std::move(query_promise));
|
||||
send_message_reaction(td_, full_message_id, m->reactions->get_chosen_reactions(), is_big, add_to_recent,
|
||||
std::move(query_promise));
|
||||
}
|
||||
|
||||
void MessagesManager::on_set_message_reactions(FullMessageId full_message_id, Result<Unit> result,
|
||||
|
Loading…
Reference in New Issue
Block a user