From b69eaf8669fca6f50fd2b0e101b2ac9ee8b16f8f Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 5 Mar 2024 18:04:40 +0300 Subject: [PATCH] Send update about quick reply messages only after shortcut updates. --- td/telegram/QuickReplyManager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/td/telegram/QuickReplyManager.cpp b/td/telegram/QuickReplyManager.cpp index 8d4501434..09f579135 100644 --- a/td/telegram/QuickReplyManager.cpp +++ b/td/telegram/QuickReplyManager.cpp @@ -1110,8 +1110,8 @@ void QuickReplyManager::delete_quick_reply_messages(Shortcut *s, const vectorserver_total_count_ = quick_reply_messages.size(); shortcut->messages_ = std::move(quick_reply_messages); - auto is_object_changed = false; if (old_shortcut == nullptr) { CHECK(have_all_shortcut_messages(shortcut.get())); send_update_quick_reply_shortcut(shortcut.get(), "on_reload_quick_reply_messages 1"); @@ -1254,16 +1253,19 @@ void QuickReplyManager::on_reload_quick_reply_messages( } shortcuts_.shortcuts_.push_back(std::move(shortcut)); } else { + auto is_object_changed = false; if (update_shortcut_from(shortcut.get(), old_shortcut, false, &is_object_changed)) { CHECK(have_all_shortcut_messages(shortcut.get())); - send_update_quick_reply_shortcut_messages(shortcut.get(), "on_reload_quick_reply_messages 3"); + if (is_object_changed) { + send_update_quick_reply_shortcut(shortcut.get(), "on_reload_quick_reply_messages 3"); + } + send_update_quick_reply_shortcut_messages(shortcut.get(), "on_reload_quick_reply_messages 4"); + } else if (is_object_changed) { + send_update_quick_reply_shortcut(shortcut.get(), "on_reload_quick_reply_messages 5"); } *it = std::move(shortcut); } - if (is_object_changed) { - send_update_quick_reply_shortcut(it->get(), "on_reload_quick_reply_messages 4"); - } save_quick_reply_shortcuts(); break; }