Fix GetChannelDifferenceLogEvent handling.

GitOrigin-RevId: facbb318cbba1c9ac6908db86ec5fba123c88d7b
This commit is contained in:
levlam 2020-10-21 16:54:32 +03:00
parent d17531e0e3
commit 0256a95f49

View File

@ -33826,6 +33826,12 @@ void MessagesManager::get_channel_difference(DialogId dialog_id, int32 pts, bool
after_get_channel_difference(dialog_id, false); after_get_channel_difference(dialog_id, false);
return; return;
} }
if (!have_input_peer(dialog_id, AccessRights::Read)) {
LOG(INFO) << "Skip running channels.getDifference for " << dialog_id << " from " << source
<< " because have no read access to it";
after_get_channel_difference(dialog_id, false);
return;
}
if (force && get_channel_difference_to_log_event_id_.count(dialog_id) == 0 && !G()->ignore_backgrond_updates()) { if (force && get_channel_difference_to_log_event_id_.count(dialog_id) == 0 && !G()->ignore_backgrond_updates()) {
auto channel_id = dialog_id.get_channel_id(); auto channel_id = dialog_id.get_channel_id();
@ -33850,14 +33856,6 @@ void MessagesManager::do_get_channel_difference(DialogId dialog_id, int32 pts, b
<< " because it has already been run"; << " because it has already been run";
return; return;
} }
bool have_access = have_input_peer(dialog_id, AccessRights::Read);
if (!have_access) {
LOG(INFO) << "Skip running channels.getDifference for " << dialog_id << " from " << source
<< " because have no read access to it";
active_get_channel_differencies_.erase(dialog_id);
after_get_channel_difference(dialog_id, false);
return;
}
// can be called multiple times before after_get_channel_difference // can be called multiple times before after_get_channel_difference
const Dialog *d = get_dialog(dialog_id); const Dialog *d = get_dialog(dialog_id);