Add check for administrator rights in reportSupergroupSpam.

This commit is contained in:
levlam 2021-12-15 21:45:30 +03:00
parent 86c4bac69d
commit 871f91b896

View File

@ -6665,6 +6665,9 @@ void ContactsManager::report_channel_spam(ChannelId channel_id, const vector<Mes
if (!c->is_megagroup) {
return promise.set_error(Status::Error(400, "Spam can be reported only in supergroups"));
}
if (!c->status.is_administrator()) {
return promise.set_error(Status::Error(400, "Spam can be reported only by chat administrators"));
}
std::unordered_map<DialogId, vector<MessageId>, DialogIdHash> server_message_ids;
for (auto &message_id : message_ids) {