Show error-by-privacy in adding user as admin.

This commit is contained in:
John Preston 2019-06-05 19:47:08 +03:00
parent 6f4e31c9c3
commit c2b2236e64
2 changed files with 6 additions and 18 deletions

View File

@ -141,6 +141,11 @@ void ShowAddParticipantsError(
return PeerFloodErrorText(isGroup
? PeerFloodType::InviteGroup
: PeerFloodType::InviteChannel);
} else if (error == qstr("ADMINS_TOO_MUCH")) {
const auto isGroup = (chat->isChat() || chat->isMegagroup());
return lang(isGroup
? lng_error_admin_limit
: lng_error_admin_limit_channel);
}
return lang(lng_failed_add_participant);
}();

View File

@ -131,24 +131,7 @@ void SaveChannelAdmin(
onDone();
}
}).fail([=](const RPCError &error) {
if (error.type() == qstr("USER_NOT_MUTUAL_CONTACT")) {
Ui::show(
Box<InformBox>(PeerFloodErrorText(
channel->isMegagroup()
? PeerFloodType::InviteGroup
: PeerFloodType::InviteChannel)),
LayerOption::KeepOther);
} else if (error.type() == qstr("BOT_GROUPS_BLOCKED")) {
Ui::show(
Box<InformBox>(lang(lng_error_cant_add_bot)),
LayerOption::KeepOther);
} else if (error.type() == qstr("ADMINS_TOO_MUCH")) {
Ui::show(
Box<InformBox>(lang(channel->isMegagroup()
? lng_error_admin_limit
: lng_error_admin_limit_channel)),
LayerOption::KeepOther);
}
ShowAddParticipantsError(error.type(), channel, { 1, user });
if (onFail) {
onFail();
}