From 5110a188b219a30172ec86b27dd18f38b877b6dc Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 24 Jul 2023 15:56:03 +0300 Subject: [PATCH] Improve MessageReplyInfo logging and updating. --- td/telegram/MessageReplyInfo.cpp | 9 +++++++-- td/telegram/MessagesManager.cpp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/td/telegram/MessageReplyInfo.cpp b/td/telegram/MessageReplyInfo.cpp index 831482c27..865b58ee6 100644 --- a/td/telegram/MessageReplyInfo.cpp +++ b/td/telegram/MessageReplyInfo.cpp @@ -101,6 +101,10 @@ bool MessageReplyInfo::need_update_to(const MessageReplyInfo &other) const { // ignore updates to empty reply info, because we will hide the info ourselves // return true; } + if (other.is_comment_ != is_comment_ && !other.was_dropped()) { + LOG(ERROR) << "Reply info has changed from " << *this << " to " << other; + return true; + } if (other.pts_ < pts_ && !other.was_dropped()) { return false; } @@ -222,10 +226,11 @@ StringBuilder &operator<<(StringBuilder &string_builder, const MessageReplyInfo if (reply_info.is_comment_) { return string_builder << reply_info.reply_count_ << " comments in " << reply_info.channel_id_ << " by " << reply_info.recent_replier_dialog_ids_ << " read up to " - << reply_info.last_read_inbox_message_id_ << "/" << reply_info.last_read_outbox_message_id_; + << reply_info.last_read_inbox_message_id_ << '/' << reply_info.last_read_outbox_message_id_ + << " with PTS " << reply_info.pts_; } else { return string_builder << reply_info.reply_count_ << " replies read up to " << reply_info.last_read_inbox_message_id_ - << "/" << reply_info.last_read_outbox_message_id_; + << "/" << reply_info.last_read_outbox_message_id_ << " with PTS " << reply_info.pts_; } } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 44b07f017..db7edae13 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -7188,6 +7188,7 @@ bool MessagesManager::update_message_interaction_info(Dialog *d, Message *m, int LOG(DEBUG) << "Update interaction info of " << full_message_id << " from " << m->view_count << '/' << m->forward_count << '/' << m->reply_info << '/' << m->reactions << " to " << view_count << '/' << forward_count << '/' << reply_info << '/' << reactions + << ", need_update_reply_info = " << need_update_reply_info << ", need_update_reactions = " << need_update_reactions << ", need_update_unread_reactions = " << need_update_unread_reactions << ", need_update_chosen_reaction_order = " << need_update_chosen_reaction_order;