Show error when adding a non-group bot to admins.

This commit is contained in:
John Preston 2017-07-10 13:55:20 +03:00
parent f7543e3261
commit 9344504781
2 changed files with 7 additions and 1 deletions

View file

@ -145,6 +145,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
"lng_error_public_groups_denied" = "Unfortunately, you were banned from participating in public groups.\n{more_info}";
"lng_error_cant_edit_admin" = "Sorry, you can't edit permissions for this admin.";
"lng_error_cant_add_member" = "Sorry, you can't add the bot to this group. Ask a group admin to do it.";
"lng_error_cant_add_bot" = "Sorry, this bot can't be added to groups.";
"lng_error_cant_add_admin_invite" = "Sorry, you can't add this user as an admin because they are not a member of this group and you are not allowed to invite them.";
"lng_error_cant_add_admin_unban" = "Sorry, you can't add this user as an admin because they are in the blacklist and you can't unban them.";
"lng_error_cant_ban_admin" = "Sorry, you can't ban this user because they are an admin in this group and you are not allowed to demote them.";

View file

@ -685,12 +685,17 @@ void AddParticipantBoxController::editAdmin(gsl::not_null<UserData*> user, bool
if (weak) {
weak->editAdminDone(user, newRights);
}
}), rpcFail([channel](const RPCError &error) {
}), rpcFail([channel, weak](const RPCError &error) {
if (MTP::isDefaultHandledError(error)) {
return false;
}
if (error.type() == qstr("USER_NOT_MUTUAL_CONTACT")) {
Ui::show(Box<InformBox>(PeerFloodErrorText(channel->isMegagroup() ? PeerFloodType::InviteGroup : PeerFloodType::InviteChannel)), KeepOtherLayers);
} else if (error.type() == qstr("BOT_GROUPS_BLOCKED")) {
Ui::show(Box<InformBox>(lang(lng_error_cant_add_bot)), KeepOtherLayers);
}
if (weak && weak->_editBox) {
weak->_editBox->closeBox();
}
return true;
}));