Simplify checks in AdministratorRights.
This commit is contained in:
parent
85e64fc3b9
commit
a885f3bc63
@ -83,7 +83,7 @@ AdministratorRights::AdministratorRights(bool is_anonymous, bool can_manage_dial
|
||||
|
||||
telegram_api::object_ptr<telegram_api::chatAdminRights> AdministratorRights::get_chat_admin_rights() const {
|
||||
int32 flags = 0;
|
||||
if ((flags_ & CAN_CHANGE_INFO_AND_SETTINGS) != 0) {
|
||||
if (can_change_info_and_settings()) {
|
||||
flags |= telegram_api::chatAdminRights::CHANGE_INFO_MASK;
|
||||
}
|
||||
if (can_post_messages()) {
|
||||
@ -95,13 +95,13 @@ telegram_api::object_ptr<telegram_api::chatAdminRights> AdministratorRights::get
|
||||
if (can_delete_messages()) {
|
||||
flags |= telegram_api::chatAdminRights::DELETE_MESSAGES_MASK;
|
||||
}
|
||||
if ((flags_ & CAN_INVITE_USERS) != 0) {
|
||||
if (can_invite_users()) {
|
||||
flags |= telegram_api::chatAdminRights::INVITE_USERS_MASK;
|
||||
}
|
||||
if (can_restrict_members()) {
|
||||
flags |= telegram_api::chatAdminRights::BAN_USERS_MASK;
|
||||
}
|
||||
if ((flags_ & CAN_PIN_MESSAGES) != 0) {
|
||||
if (can_pin_messages()) {
|
||||
flags |= telegram_api::chatAdminRights::PIN_MESSAGES_MASK;
|
||||
}
|
||||
if (can_promote_members()) {
|
||||
|
@ -88,11 +88,6 @@ class AdministratorRights {
|
||||
return (flags_ & CAN_INVITE_USERS) != 0;
|
||||
}
|
||||
|
||||
bool can_manage_invite_links() const {
|
||||
// invite links can be managed, only if administrator was explicitly granted the right
|
||||
return (flags_ & CAN_INVITE_USERS) != 0;
|
||||
}
|
||||
|
||||
bool can_restrict_members() const {
|
||||
return (flags_ & CAN_RESTRICT_MEMBERS) != 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user