From fbc738c8dfff8ef7b9c6b98c01d0a169552016b3 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 4 Mar 2024 15:11:36 +0300 Subject: [PATCH] Improve updates after quick reply message deletion. --- td/telegram/QuickReplyManager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/td/telegram/QuickReplyManager.cpp b/td/telegram/QuickReplyManager.cpp index ffa950a51..4b6336339 100644 --- a/td/telegram/QuickReplyManager.cpp +++ b/td/telegram/QuickReplyManager.cpp @@ -1042,13 +1042,13 @@ void QuickReplyManager::delete_quick_reply_messages(Shortcut *s, const vectorshortcut_id_ << " from " << source; bool is_changed = false; - bool is_list_changed = false; + bool is_shortcut_object_changed = false; for (auto &message_id : message_ids) { auto it = get_message_it(s, message_id); if (it != s->messages_.end()) { delete_message_files(s->shortcut_id_, it->get()); if (it == s->messages_.begin()) { - is_list_changed = true; + is_shortcut_object_changed = true; } is_changed = true; s->messages_.erase(it); @@ -1060,14 +1060,14 @@ void QuickReplyManager::delete_quick_reply_messages(Shortcut *s, const vectormessages_.empty()) { send_update_quick_reply_shortcut_deleted(s); shortcuts_.shortcuts_.erase(get_shortcut_it(s->shortcut_id_)); - CHECK(is_list_changed && is_changed); + CHECK(is_shortcut_object_changed && is_changed); + save_quick_reply_shortcuts(); + send_update_quick_reply_shortcuts(); } else if (is_changed) { send_update_quick_reply_shortcut_messages(s, source); - } - if (is_list_changed) { - send_update_quick_reply_shortcuts(); - } - if (is_changed) { + if (is_shortcut_object_changed) { + send_update_quick_reply_shortcut(s, source); + } save_quick_reply_shortcuts(); } }