Update basic group position when it is joined or left.

This commit is contained in:
levlam 2023-05-08 17:29:50 +03:00
parent ac8c4718d3
commit ce76e164a9
3 changed files with 13 additions and 0 deletions

View File

@ -11933,6 +11933,10 @@ void ContactsManager::update_chat(Chat *c, ChatId chat_id, bool from_binlog, boo
if (!c->status.can_manage_invite_links()) {
td_->messages_manager_->drop_dialog_pending_join_requests(DialogId(chat_id));
}
if (!from_database) {
// if the chat is empty, this can add it to a chat list or remove it from a chat list
send_closure_later(G()->messages_manager(), &MessagesManager::try_update_dialog_pos, DialogId(chat_id));
}
c->is_status_changed = false;
}
if (c->is_noforwards_changed) {

View File

@ -36192,6 +36192,13 @@ MessageId MessagesManager::get_message_id_by_random_id(Dialog *d, int64 random_i
return it->second;
}
void MessagesManager::try_update_dialog_pos(DialogId dialog_id) {
Dialog *d = get_dialog(dialog_id);
if (d != nullptr && d->is_update_new_chat_sent) {
update_dialog_pos(d, "try_update_dialog_pos");
}
}
void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source, bool expect_no_access,
bool force_update_dialog_pos) {
LOG_CHECK(dialog_id.is_valid()) << source;

View File

@ -957,6 +957,8 @@ class MessagesManager final : public Actor {
void on_get_channel_difference(DialogId dialog_id, int32 request_pts, int32 request_limit,
tl_object_ptr<telegram_api::updates_ChannelDifference> &&difference_ptr);
void try_update_dialog_pos(DialogId dialog_id);
void force_create_dialog(DialogId dialog_id, const char *source, bool expect_no_access = false,
bool force_update_dialog_pos = false);