From bf95e2f0517961196c1d8d82d03292e518b33cc2 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 14 Apr 2019 04:11:00 +0300 Subject: [PATCH] Fix removing pinned message notification. GitOrigin-RevId: d01a6d955944f5990c59fc5a1e565f7d9956bcb3 --- td/telegram/MessagesManager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 2b853bf4..1575c94e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -10302,10 +10302,9 @@ void MessagesManager::set_dialog_pinned_message_notification(Dialog *d, MessageI if (old_message_id.is_valid()) { auto m = get_message_force(d, old_message_id, "set_dialog_pinned_message_notification"); if (m != nullptr && m->notification_id.is_valid() && is_message_notification_active(d, m)) { - // to not call set_dialog_pinned_message_notification recursively from remove_message_notification_id - // can't be set before is_message_notification_active check - d->pinned_message_notification_message_id = message_id; - + // Because we removing pinned message notification it will call set_dialog_pinned_message_notification recursively + // after m->notification_id is removed, so everything will work. Can't remove pinned_message_notification_message_id + // before the call, because the notification needs to be still active inside remove_message_notification_id remove_message_notification_id(d, m, true, false); on_message_changed(d, m, false, "set_dialog_pinned_message_notification"); } else {