Remove channels from inactive channels list on new message or after leave.
GitOrigin-RevId: 8c9723ed489a714df0b70abe465c04eba1265b0e
This commit is contained in:
parent
71ddd7c7e3
commit
3ec96b4c30
@ -6053,6 +6053,12 @@ void ContactsManager::on_get_inactive_channels(vector<tl_object_ptr<telegram_api
|
||||
inactive_channels_ = get_channel_ids(std::move(chats), "on_get_inactive_channels");
|
||||
}
|
||||
|
||||
void ContactsManager::remove_inactive_channel(ChannelId channel_id) {
|
||||
if (inactive_channels_inited_ && td::remove(inactive_channels_, channel_id)) {
|
||||
LOG(DEBUG) << "Remove " << channel_id << " from list of inactive channels";
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::on_imported_contacts(int64 random_id, vector<UserId> imported_contact_user_ids,
|
||||
vector<int32> unimported_contact_invites) {
|
||||
LOG(INFO) << "Contacts import with random_id " << random_id
|
||||
@ -7953,6 +7959,9 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
|
||||
if (c->is_megagroup) {
|
||||
update_dialogs_for_discussion(DialogId(channel_id), c->status.is_administrator() && c->status.can_pin_messages());
|
||||
}
|
||||
if (!c->status.is_member()) {
|
||||
remove_inactive_channel(channel_id);
|
||||
}
|
||||
}
|
||||
if (c->is_username_changed) {
|
||||
if (c->status.is_creator() && created_public_channels_inited_[0]) {
|
||||
|
@ -231,6 +231,8 @@ class ContactsManager : public Actor {
|
||||
|
||||
void on_get_inactive_channels(vector<tl_object_ptr<telegram_api::Chat>> &&chats);
|
||||
|
||||
void remove_inactive_channel(ChannelId channel_id);
|
||||
|
||||
UserId get_my_id() const;
|
||||
|
||||
void set_my_online_status(bool is_online, bool send_update, bool is_local);
|
||||
|
@ -25944,6 +25944,9 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
||||
td_->contacts_manager_->on_update_channel_slow_mode_next_send_date(channel_id, m->date + slow_mode_delay);
|
||||
}
|
||||
}
|
||||
if (m->date > now - 14 * 86400) {
|
||||
td_->contacts_manager_->remove_inactive_channel(dialog_id.get_channel_id());
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_attached && !m->have_next && !m->have_previous) {
|
||||
|
Loading…
Reference in New Issue
Block a user