From 2f687edf17639c8c9430eac50d613c366e083f94 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 8 Apr 2021 03:06:05 +0300 Subject: [PATCH] Don't decrease max_unavailable_message_id when processing MessageDeleteChatHistory. --- td/telegram/MessagesManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 298b511c5..b0032e6a9 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -32118,7 +32118,9 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq } LOG(INFO) << "Process MessageChatDeleteHistory in " << message_id << " in " << dialog_id << " with date " << message->date << " from " << source; - set_dialog_max_unavailable_message_id(dialog_id, message_id, false, "message chat delete history"); + if (message_id > d->max_unavailable_message_id) { + set_dialog_max_unavailable_message_id(dialog_id, message_id, false, "message chat delete history"); + } CHECK(!message->from_database); debug_add_message_to_dialog_fail_reason_ = "skip adding MessageChatDeleteHistory"; return nullptr;