Call getChannelFull when join channel.

GitOrigin-RevId: abda6c7886e298852ab3e5f1c332db1eb32f2c3c
This commit is contained in:
levlam 2018-04-30 15:04:57 +03:00
parent b998431081
commit 4913915a8e
2 changed files with 10 additions and 2 deletions

View File

@ -6164,15 +6164,16 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
}
bool have_read_access = have_input_peer_channel(c, AccessRights::Read);
bool is_member = c->status.is_member();
if (c->had_read_access && !have_read_access) {
send_closure_later(G()->messages_manager(), &MessagesManager::delete_dialog, DialogId(channel_id));
} else if (c->was_member != c->status.is_member()) {
} else if (!from_database && c->was_member != is_member) {
DialogId dialog_id(channel_id);
send_closure_later(G()->messages_manager(), &MessagesManager::force_create_dialog, dialog_id, "update channel",
true);
}
c->had_read_access = have_read_access;
c->was_member = c->status.is_member();
c->was_member = is_member;
}
void ContactsManager::update_secret_chat(SecretChat *c, SecretChatId secret_chat_id, bool from_binlog,

View File

@ -23900,6 +23900,8 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
get_history_from_the_end(dialog_id, true, false, Auto());
}
update_dialog_pos(d, false, "fix_new_dialog");
LOG(INFO) << "Loaded " << dialog_id << " with last new " << d->last_new_message_id << ", first database "
<< d->first_database_message_id << ", last database " << d->last_database_message_id << ", last "
<< d->last_message_id;
@ -24142,6 +24144,11 @@ bool MessagesManager::set_dialog_order(Dialog *d, int64 new_order, bool need_sen
}
send_update_unread_message_count(d->dialog_id, true, source);
}
if (d->dialog_id.get_type() == DialogType::Channel && d->order == DEFAULT_ORDER) {
LOG(INFO) << "Reload ChannelFull for " << d->dialog_id << " to repair unread message counts";
td_->contacts_manager_->get_channel_full(d->dialog_id.get_channel_id(), Auto());
}
}
d->order = new_order;