Drop channel pts in inaccessible channels.
This commit is contained in:
parent
090056f21d
commit
d069de6a8b
@ -13192,6 +13192,11 @@ void ContactsManager::on_channel_status_changed(const Channel *c, ChannelId chan
|
|||||||
if (td_->auth_manager_->is_bot() && old_status.is_administrator() && !new_status.is_administrator()) {
|
if (td_->auth_manager_->is_bot() && old_status.is_administrator() && !new_status.is_administrator()) {
|
||||||
channel_participants_.erase(channel_id);
|
channel_participants_.erase(channel_id);
|
||||||
}
|
}
|
||||||
|
if (td_->auth_manager_->is_bot() && old_status.is_member() && !new_status.is_member() &&
|
||||||
|
!G()->parameters().use_message_db) {
|
||||||
|
send_closure_later(G()->messages_manager(), &MessagesManager::on_dialog_deleted, DialogId(channel_id),
|
||||||
|
Promise<Unit>());
|
||||||
|
}
|
||||||
|
|
||||||
// must not load ChannelFull, because must not change the Channel
|
// must not load ChannelFull, because must not change the Channel
|
||||||
CHECK(have_channel_full == (get_channel_full(channel_id) != nullptr));
|
CHECK(have_channel_full == (get_channel_full(channel_id) != nullptr));
|
||||||
|
@ -10968,6 +10968,9 @@ void MessagesManager::on_dialog_deleted(DialogId dialog_id, Promise<Unit> &&prom
|
|||||||
if (remove_recently_found_dialog_internal(dialog_id)) {
|
if (remove_recently_found_dialog_internal(dialog_id)) {
|
||||||
save_recently_found_dialogs();
|
save_recently_found_dialogs();
|
||||||
}
|
}
|
||||||
|
if (dialog_id.get_type() == DialogType::Channel) {
|
||||||
|
G()->td_db()->get_binlog_pmc()->erase(get_channel_pts_key(dialog_id));
|
||||||
|
}
|
||||||
|
|
||||||
close_dialog(d);
|
close_dialog(d);
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
@ -34958,7 +34961,7 @@ string MessagesManager::get_channel_pts_key(DialogId dialog_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32 MessagesManager::load_channel_pts(DialogId dialog_id) const {
|
int32 MessagesManager::load_channel_pts(DialogId dialog_id) const {
|
||||||
if (G()->ignore_background_updates()) {
|
if (G()->ignore_background_updates() || !have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
G()->td_db()->get_binlog_pmc()->erase(get_channel_pts_key(dialog_id)); // just in case
|
G()->td_db()->get_binlog_pmc()->erase(get_channel_pts_key(dialog_id)); // just in case
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -35009,7 +35012,7 @@ void MessagesManager::set_channel_pts(Dialog *d, int32 new_pts, const char *sour
|
|||||||
repair_channel_server_unread_count(d);
|
repair_channel_server_unread_count(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!G()->ignore_background_updates()) {
|
if (!G()->ignore_background_updates() && have_input_peer(d->dialog_id, AccessRights::Read)) {
|
||||||
G()->td_db()->get_binlog_pmc()->set(get_channel_pts_key(d->dialog_id), to_string(new_pts));
|
G()->td_db()->get_binlog_pmc()->set(get_channel_pts_key(d->dialog_id), to_string(new_pts));
|
||||||
}
|
}
|
||||||
} else if (new_pts < d->pts) {
|
} else if (new_pts < d->pts) {
|
||||||
|
Loading…
Reference in New Issue
Block a user