From d5a19f0a82db2f6ec7784399999feedf3c661660 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 29 Jul 2021 02:42:53 +0300 Subject: [PATCH] Don't add last new message in on_get_dialog if it is supposed to be added through get_channel_difference. --- td/telegram/MessagesManager.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index d0a7306a8..e78ddf139 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14458,7 +14458,7 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vectorpts == 0 || dialog->pts_ <= d->pts) { auto added_full_message_id = on_get_message(std::move(last_message), false, has_pts, false, false, false, "get chats"); CHECK(d->last_new_message_id == MessageId()); @@ -14468,14 +14468,13 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vectorlast_new_message_id, "on_get_dialogs"); send_update_chat_last_message(d, "on_get_dialogs"); } + } else { + get_channel_difference(dialog_id, d->pts, true, "on_get_dialogs"); } } if (has_pts && !running_get_channel_difference(dialog_id)) { - int32 channel_pts = dialog->pts_; - LOG_IF(ERROR, channel_pts < d->pts) << "In new " << dialog_id << " pts = " << d->pts - << ", but pts = " << channel_pts << " received in GetChats"; - set_channel_pts(d, channel_pts, "get channel"); + set_channel_pts(d, dialog->pts_, "get channel"); } } bool is_marked_as_unread = (dialog->flags_ & telegram_api::dialog::UNREAD_MARK_MASK) != 0;