From 036a7cd539522aa6b2de103edb32091c670af0dd Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 27 Apr 2023 18:46:51 +0300 Subject: [PATCH] Ensure that my_dialog_id is the same for all reactions. --- td/telegram/MessageReaction.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/td/telegram/MessageReaction.cpp b/td/telegram/MessageReaction.cpp index f2232aa71..e8b21eb70 100644 --- a/td/telegram/MessageReaction.cpp +++ b/td/telegram/MessageReaction.cpp @@ -544,6 +544,20 @@ unique_ptr MessageReactions::get_message_reactions( result->can_get_added_reactions_ = reactions->can_see_list_; result->is_min_ = reactions->min_; + DialogId my_dialog_id; + for (auto &peer_reaction : reactions->recent_reactions_) { + if (peer_reaction->my_) { + DialogId dialog_id(peer_reaction->peer_id_); + if (!dialog_id.is_valid()) { + continue; + } + if (my_dialog_id.is_valid() && dialog_id != my_dialog_id) { + LOG(ERROR) << "Receive my reactions with " << dialog_id << " and " << my_dialog_id; + } + my_dialog_id = dialog_id; + } + } + FlatHashSet reaction_strings; vector> chosen_reaction_order; for (auto &reaction_count : reactions->results_) { @@ -559,7 +573,6 @@ unique_ptr MessageReactions::get_message_reactions( continue; } - DialogId my_dialog_id; FlatHashSet recent_choosers; vector recent_chooser_dialog_ids; vector> recent_chooser_min_channels; @@ -596,12 +609,6 @@ unique_ptr MessageReactions::get_message_reactions( continue; } } - if (peer_reaction->my_) { - if (my_dialog_id.is_valid() && dialog_id != my_dialog_id) { - LOG(ERROR) << "Receive my reactions with " << dialog_id << " and " << my_dialog_id; - } - my_dialog_id = dialog_id; - } recent_chooser_dialog_ids.push_back(dialog_id); if (peer_reaction->unread_) {