diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 4395d4e0..e4a2ed94 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4924,6 +4924,26 @@ void ContactsManager::on_get_dialogs_for_discussion(vector imported_contact_user_ids, vector unimported_contact_invites) { LOG(INFO) << "Contacts import with random_id " << random_id @@ -6446,9 +6466,13 @@ void ContactsManager::update_chat(Chat *c, ChatId chat_id, bool from_binlog, boo if (c->is_default_permissions_changed) { td_->messages_manager_->on_dialog_permissions_updated(DialogId(chat_id)); } + if (c->is_is_active_changed) { + update_dialogs_for_discussion(DialogId(chat_id), c->is_active && c->status.is_creator()); + } c->is_photo_changed = false; c->is_title_changed = false; c->is_default_permissions_changed = false; + c->is_is_active_changed = false; LOG(DEBUG) << "Update " << chat_id << ": is_changed = " << c->is_changed << ", need_send_update = " << c->need_send_update; @@ -6507,6 +6531,10 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from } else { channel_unban_timeout_.cancel_timeout(channel_id.get()); } + + if (c->is_megagroup) { + update_dialogs_for_discussion(DialogId(channel_id), c->status.is_administrator() && c->status.can_pin_messages()); + } } if (c->is_username_changed) { if (c->status.is_creator() && created_public_channels_inited_) { @@ -8732,6 +8760,7 @@ void ContactsManager::on_update_chat_title(Chat *c, ChatId chat_id, string &&tit void ContactsManager::on_update_chat_active(Chat *c, ChatId chat_id, bool is_active) { if (c->is_active != is_active) { c->is_active = is_active; + c->is_is_active_changed = true; c->need_send_update = true; } } diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 02b57f86..6b4289c5 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -602,6 +602,7 @@ class ContactsManager : public Actor { bool is_title_changed = true; bool is_photo_changed = true; bool is_default_permissions_changed = true; + bool is_is_active_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 @@ -1105,6 +1106,8 @@ class ContactsManager : public Actor { vector get_dialog_ids(vector> &&chats, const char *source); + void update_dialogs_for_discussion(DialogId dialog_id, bool is_suitable); + void delete_chat_participant(ChatId chat_id, UserId user_id, Promise &&promise); void change_channel_participant_status_impl(ChannelId channel_id, UserId user_id, DialogParticipantStatus status,