Check that other chats are only banned or unbanned.

This commit is contained in:
levlam 2021-03-26 04:15:13 +03:00
parent 14fc0898ad
commit 7a65988f29

View File

@ -7422,6 +7422,19 @@ void ContactsManager::restrict_channel_participant(ChannelId channel_id, DialogI
return;
}
switch (participant_dialog_id.get_type()) {
case DialogType::User:
// ok;
break;
case DialogType::Channel:
if (!status.is_banned() && !status.is_left()) {
return promise.set_error(Status::Error(400, "Other chats can be only banned or unbanned"));
}
break;
default:
return promise.set_error(Status::Error(400, "Can't restrict the chat"));
}
CHECK(!old_status.is_creator());
CHECK(!status.is_creator());