Always create chat to update its order when channel status changes.
This commit is contained in:
parent
e15768d520
commit
38a1d7ac8e
@ -5004,17 +5004,11 @@ void ChatManager::update_channel(Channel *c, ChannelId channel_id, bool from_bin
|
||||
}
|
||||
|
||||
bool have_read_access = have_input_peer_channel(c, channel_id, AccessRights::Read);
|
||||
bool is_member = c->status.is_member();
|
||||
if (c->had_read_access && !have_read_access) {
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_dialog_deleted, DialogId(channel_id),
|
||||
Promise<Unit>());
|
||||
} 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, true);
|
||||
}
|
||||
c->had_read_access = have_read_access;
|
||||
c->was_member = is_member;
|
||||
|
||||
if (c->cache_version != Channel::CACHE_VERSION && !c->is_repaired &&
|
||||
have_input_peer_channel(c, channel_id, AccessRights::Read) && !G()->close_flag()) {
|
||||
@ -6976,13 +6970,16 @@ void ChatManager::on_channel_status_changed(Channel *c, ChannelId channel_id, co
|
||||
Promise<Unit>());
|
||||
}
|
||||
if (!is_bot && old_status.is_member() != new_status.is_member()) {
|
||||
DialogId dialog_id(channel_id);
|
||||
if (new_status.is_member()) {
|
||||
send_closure_later(td_->story_manager_actor_, &StoryManager::reload_dialog_expiring_stories,
|
||||
DialogId(channel_id));
|
||||
send_closure_later(td_->story_manager_actor_, &StoryManager::reload_dialog_expiring_stories, dialog_id);
|
||||
} else {
|
||||
send_closure_later(td_->story_manager_actor_, &StoryManager::on_dialog_active_stories_order_updated,
|
||||
DialogId(channel_id), "on_channel_status_changed");
|
||||
send_closure_later(td_->story_manager_actor_, &StoryManager::on_dialog_active_stories_order_updated, dialog_id,
|
||||
"on_channel_status_changed");
|
||||
}
|
||||
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::force_create_dialog, dialog_id,
|
||||
"on_channel_status_changed", true, true);
|
||||
}
|
||||
|
||||
// must not load ChannelFull, because must not change the Channel
|
||||
|
@ -517,7 +517,6 @@ class ChatManager final : public Actor {
|
||||
bool is_noforwards_changed = true;
|
||||
bool is_creator_changed = true;
|
||||
bool had_read_access = true;
|
||||
bool was_member = false;
|
||||
bool is_being_updated = false;
|
||||
bool is_changed = true; // have new changes that need to be sent to the client and database
|
||||
bool need_save_to_database = true; // have new changes that need only to be saved to the database
|
||||
|
Loading…
Reference in New Issue
Block a user