From c1a14d887baaa41beca7fd2606a5a086630064b9 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 10 Feb 2021 14:36:33 +0300 Subject: [PATCH] Don't send updateDeleteMessage twice for the same message. --- 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 9aacd2d14..f668f068b 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -9980,6 +9980,7 @@ void MessagesManager::delete_dialog_messages(DialogId dialog_id, const vector deleted_message_ids; bool need_update_dialog_pos = false; for (auto message_id : message_ids) { + CHECK(!message_id.is_scheduled()); if (from_updates) { if (!message_id.is_valid() || (!message_id.is_server() && dialog_id.get_type() != DialogType::SecretChat)) { LOG(ERROR) << "Incoming update tries to delete " << message_id; @@ -9989,9 +9990,10 @@ void MessagesManager::delete_dialog_messages(DialogId dialog_id, const vectordeleted_message_ids.count(message_id) != 0; auto message = delete_message(d, message_id, true, &need_update_dialog_pos, "delete_dialog_messages"); if (message == nullptr) { - if (!skip_update_for_not_found_messages) { + if (!skip_update_for_not_found_messages && !was_already_deleted) { deleted_message_ids.push_back(message_id.get()); } } else {