diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index a8771a88..77a0c8c4 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -6358,6 +6358,11 @@ void ContactsManager::update_secret_chat(SecretChat *c, SecretChatId secret_chat DialogId dialog_id(secret_chat_id); send_closure_later(G()->messages_manager(), &MessagesManager::force_create_dialog, dialog_id, "update secret chat", true); + if (c->is_state_changed) { + send_closure_later(G()->messages_manager(), &MessagesManager::on_update_secret_chat_state, secret_chat_id, + c->state); + c->is_state_changed = false; + } } if (!from_database) { @@ -8910,7 +8915,7 @@ void ContactsManager::on_update_secret_chat(SecretChatId secret_chat_id, int64 a if (state != SecretChatState::Unknown && state != secret_chat->state) { secret_chat->state = state; secret_chat->need_send_update = true; - td_->messages_manager_->on_update_secret_chat_state(secret_chat_id, state); + secret_chat->is_state_changed = true; } if (is_outbound != secret_chat->is_outbound) { secret_chat->is_outbound = is_outbound; diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index a8fe1778..d00bb1f5 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -664,6 +664,7 @@ class ContactsManager : public Actor { bool is_outbound = false; + bool is_state_changed = true; bool is_changed = true; // have new changes not sent to the database except changes visible to the client bool need_send_update = true; // have new changes not sent to the client diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index bebf0b44..52e33bc5 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -19274,7 +19274,7 @@ void MessagesManager::on_create_new_dialog_fail(int64 random_id, Status error, P } void MessagesManager::on_dialog_photo_updated(DialogId dialog_id) { - auto d = get_dialog(dialog_id); + auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog if (d != nullptr && d->is_update_new_chat_sent) { send_closure(G()->td(), &Td::send_update, make_tl_object( @@ -19283,7 +19283,7 @@ void MessagesManager::on_dialog_photo_updated(DialogId dialog_id) { } void MessagesManager::on_dialog_title_updated(DialogId dialog_id) { - auto d = get_dialog(dialog_id); + auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog if (d != nullptr) { update_dialogs_hints(d); if (d->is_update_new_chat_sent) {