From 14670fb1e66c06c91beed926ed2fa8f115e47721 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 4 Feb 2019 21:18:51 +0300 Subject: [PATCH] Fix setting of is_pinned_message_inited. GitOrigin-RevId: 0d76948b15dc5b473b80b9e136823d3c3f874e0a --- td/telegram/MessagesManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 7898785d..dfc7a461 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -19421,6 +19421,10 @@ void MessagesManager::on_update_dialog_pinned_message_id(DialogId dialog_id, Mes } if (d->pinned_message_id == pinned_message_id) { + if (!d->is_pinned_message_id_inited) { + d->is_pinned_message_id_inited = true; + on_dialog_updated(d->dialog_id, "set_dialog_is_pinned_message_id_inited"); + } return; } @@ -22545,6 +22549,7 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr &&d, d->is_last_read_outbox_message_id_inited = true; d->notification_settings.is_synchronized = true; d->know_can_report_spam = true; + d->is_pinned_message_id_inited = true; if (!is_loaded_from_database) { d->can_report_spam = td_->contacts_manager_->default_can_report_spam_in_secret_chat(dialog_id.get_secret_chat_id()); @@ -22605,7 +22610,8 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr &&last_datab send_get_dialog_query(dialog_id, Auto()); } - if (being_added_dialog_id_ != dialog_id && !d->is_pinned_message_id_inited) { + if (being_added_dialog_id_ != dialog_id && !d->is_pinned_message_id_inited && + (d->dialog_id == get_my_dialog_id() || d->dialog_id.get_type() != DialogType::User)) { // asynchronously get dialog pinned message from the server get_dialog_pinned_message(dialog_id, Auto()); }