Fix CHECK.

GitOrigin-RevId: 434142fb5dd2984b8f0b1fb598967f82f7754b26
This commit is contained in:
levlam 2018-01-10 14:31:55 +03:00
parent 3eebb16020
commit 8366ae38cd

View File

@ -4161,6 +4161,9 @@ void ContactsManager::restrict_channel_participant(ChannelId channel_id, UserId
} }
if (!c->status.is_member()) { if (!c->status.is_member()) {
if (user_id == get_my_id("restrict_channel_participant")) { if (user_id == get_my_id("restrict_channel_participant")) {
if (status.is_member()) {
return promise.set_error(Status::Error(3, "Can't unrestrict self"));
}
return promise.set_value(Unit()); return promise.set_value(Unit());
} else { } else {
return promise.set_error(Status::Error(3, "Not in the chat")); return promise.set_error(Status::Error(3, "Not in the chat"));
@ -4175,7 +4178,9 @@ void ContactsManager::restrict_channel_participant(ChannelId channel_id, UserId
if (status.is_restricted() || status.is_banned()) { if (status.is_restricted() || status.is_banned()) {
return promise.set_error(Status::Error(3, "Can't restrict self")); return promise.set_error(Status::Error(3, "Can't restrict self"));
} }
CHECK(!status.is_member()); if (status.is_member()) {
return promise.set_error(Status::Error(3, "Can't unrestrict self"));
}
// leave the channel // leave the channel
td_->create_handler<LeaveChannelQuery>(std::move(promise))->send(channel_id); td_->create_handler<LeaveChannelQuery>(std::move(promise))->send(channel_id);