Don't load dialog after ChatFull is loaded from database.

This commit is contained in:
levlam 2021-01-25 17:58:19 +03:00
parent cec5f11d17
commit 3f856ccb46
3 changed files with 8 additions and 6 deletions

View File

@ -8704,6 +8704,8 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
}
}
td_->messages_manager_->on_dialog_bots_updated(DialogId(channel_id), channel_full->bot_user_ids, true);
update_channel_full(channel_full, channel_id, true);
if (channel_full->expires_at == 0.0) {
@ -9085,7 +9087,7 @@ void ContactsManager::update_chat_full(ChatFull *chat_full, ChatId chat_id, bool
}
on_update_dialog_administrators(DialogId(chat_id), std::move(administrators), chat_full->version != -1,
from_database);
td_->messages_manager_->on_dialog_bots_updated(DialogId(chat_id), std::move(bot_user_ids));
td_->messages_manager_->on_dialog_bots_updated(DialogId(chat_id), std::move(bot_user_ids), from_database);
{
Chat *c = get_chat(chat_id);
@ -12217,7 +12219,7 @@ void ContactsManager::on_update_channel_bot_user_ids(ChannelId channel_id, vecto
auto channel_full = get_channel_full_force(channel_id, "on_update_channel_bot_user_ids");
if (channel_full == nullptr) {
td_->messages_manager_->on_dialog_bots_updated(DialogId(channel_id), std::move(bot_user_ids));
td_->messages_manager_->on_dialog_bots_updated(DialogId(channel_id), std::move(bot_user_ids), false);
return;
}
on_update_channel_full_bot_user_ids(channel_full, channel_id, std::move(bot_user_ids));
@ -12228,7 +12230,7 @@ void ContactsManager::on_update_channel_full_bot_user_ids(ChannelFull *channel_f
vector<UserId> &&bot_user_ids) {
CHECK(channel_full != nullptr);
if (channel_full->bot_user_ids != bot_user_ids) {
td_->messages_manager_->on_dialog_bots_updated(DialogId(channel_id), bot_user_ids);
td_->messages_manager_->on_dialog_bots_updated(DialogId(channel_id), bot_user_ids, false);
channel_full->bot_user_ids = std::move(bot_user_ids);
channel_full->need_save_to_database = true;
}

View File

@ -28953,12 +28953,12 @@ void MessagesManager::on_create_new_dialog_fail(int64 random_id, Status error, P
td_->updates_manager_->get_difference("on_create_new_dialog_fail");
}
void MessagesManager::on_dialog_bots_updated(DialogId dialog_id, vector<UserId> bot_user_ids) {
void MessagesManager::on_dialog_bots_updated(DialogId dialog_id, vector<UserId> bot_user_ids, bool from_database) {
if (td_->auth_manager_->is_bot()) {
return;
}
auto d = get_dialog_force(dialog_id);
auto d = from_database ? get_dialog(dialog_id) : get_dialog_force(dialog_id);
if (d == nullptr || d->reply_markup_message_id == MessageId()) {
return;
}

View File

@ -748,7 +748,7 @@ class MessagesManager : public Actor {
bool is_update_about_username_change_received(DialogId dialog_id) const;
void on_dialog_bots_updated(DialogId dialog_id, vector<UserId> bot_user_ids);
void on_dialog_bots_updated(DialogId dialog_id, vector<UserId> bot_user_ids, bool from_database);
void on_dialog_photo_updated(DialogId dialog_id);
void on_dialog_title_updated(DialogId dialog_id);