diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 4f6ec826c..29e0e6574 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -16387,14 +16387,23 @@ void ContactsManager::on_channel_status_changed(Channel *c, ChannelId channel_id send_closure_later(G()->messages_manager(), &MessagesManager::on_update_dialog_group_call_rights, DialogId(channel_id)); } - if (td_->auth_manager_->is_bot() && old_status.is_administrator() && !new_status.is_administrator()) { + bool is_bot = td_->auth_manager_->is_bot(); + if (is_bot && old_status.is_administrator() && !new_status.is_administrator()) { channel_participants_.erase(channel_id); } - if (td_->auth_manager_->is_bot() && old_status.is_member() && !new_status.is_member() && - !G()->use_message_database()) { + if (is_bot && old_status.is_member() && !new_status.is_member() && !G()->use_message_database()) { send_closure_later(G()->messages_manager(), &MessagesManager::on_dialog_deleted, DialogId(channel_id), Promise()); } + if (!is_bot && old_status.is_member() != new_status.is_member()) { + if (new_status.is_member()) { + send_closure_later(td_->story_manager_actor_, &StoryManager::reload_dialog_expiring_stories, + DialogId(channel_id)); + } else { + send_closure_later(td_->story_manager_actor_, &StoryManager::on_dialog_active_stories_order_updated, + DialogId(channel_id), "on_channel_status_changed"); + } + } // must not load ChannelFull, because must not change the Channel CHECK(have_channel_full == (get_channel_full(channel_id) != nullptr)); diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index d11730327..5b3c978b0 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -3994,7 +3994,7 @@ StoryListId StoryManager::get_dialog_story_list_id(DialogId owner_dialog_id) con void StoryManager::on_dialog_active_stories_order_updated(DialogId owner_dialog_id, const char *source) { LOG(INFO) << "Update order of active stories in " << owner_dialog_id << " from " << source; - // called from update_user, must not create the dialog and hence must not load active stories + // called from update_user/on_channel_status_changed, must not create the dialog and hence must not load active stories auto active_stories = get_active_stories_editable(owner_dialog_id); bool need_save_to_database = false; if (active_stories != nullptr &&