Update created public channels instead of dropping them when ownership is changed.

This commit is contained in:
levlam 2021-12-02 18:10:14 +03:00
parent b3bc208d63
commit cffe34e5b2
2 changed files with 8 additions and 6 deletions

View File

@ -9897,6 +9897,10 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
}
c->is_has_location_changed = false;
}
if (c->is_creator_changed) {
update_created_public_channels(c, channel_id);
c->is_creator_changed = false;
}
if (c->is_noforwards_changed) {
td_->messages_manager_->on_dialog_allow_saving_content_updated(DialogId(channel_id));
c->is_noforwards_changed = false;
@ -13216,7 +13220,7 @@ void ContactsManager::on_update_channel_status(Channel *c, ChannelId channel_id,
}
}
void ContactsManager::on_channel_status_changed(const Channel *c, ChannelId channel_id,
void ContactsManager::on_channel_status_changed(Channel *c, ChannelId channel_id,
const DialogParticipantStatus &old_status,
const DialogParticipantStatus &new_status) {
CHECK(c->is_update_supergroup_sent);
@ -13235,10 +13239,7 @@ void ContactsManager::on_channel_status_changed(const Channel *c, ChannelId chan
}
if (old_status.is_creator() != new_status.is_creator()) {
for (size_t i = 0; i < 2; i++) {
created_public_channels_inited_[i] = false;
created_public_channels_[i].clear();
}
c->is_creator_changed = true;
send_get_channel_full_query(nullptr, channel_id, Auto(), "update channel owner");
reload_dialog_administrators(DialogId(channel_id), 0, Auto());

View File

@ -814,6 +814,7 @@ class ContactsManager final : public Actor {
bool is_status_changed = true;
bool is_has_location_changed = true;
bool is_noforwards_changed = true;
bool is_creator_changed = true;
bool had_read_access = true;
bool was_member = false;
bool is_changed = true; // have new changes that need to be sent to the client and database
@ -1251,7 +1252,7 @@ class ContactsManager final : public Actor {
static void on_update_channel_full_bot_user_ids(ChannelFull *channel_full, ChannelId channel_id,
vector<UserId> &&bot_user_ids);
void on_channel_status_changed(const Channel *c, ChannelId channel_id, const DialogParticipantStatus &old_status,
void on_channel_status_changed(Channel *c, ChannelId channel_id, const DialogParticipantStatus &old_status,
const DialogParticipantStatus &new_status);
void on_channel_username_changed(const Channel *c, ChannelId channel_id, const string &old_username,
const string &new_username);