2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add 'X' and admin star in group info members.

This commit is contained in:
John Preston
2017-11-07 21:53:00 +04:00
parent 5f0ba48309
commit 1871425b2d
12 changed files with 381 additions and 52 deletions

View File

@@ -928,7 +928,8 @@ void ChannelData::setRestrictionReason(const QString &text) {
}
}
bool ChannelData::canNotEditLastAdmin(not_null<UserData*> user) const {
bool ChannelData::canEditLastAdmin(not_null<UserData*> user) const {
// Duplicated in ParticipantsBoxController::canEditAdmin :(
if (mgInfo) {
auto i = mgInfo->lastAdmins.constFind(user);
if (i != mgInfo->lastAdmins.cend()) {
@@ -940,22 +941,24 @@ bool ChannelData::canNotEditLastAdmin(not_null<UserData*> user) const {
}
bool ChannelData::canEditAdmin(not_null<UserData*> user) const {
// Duplicated in ParticipantsBoxController::canEditAdmin :(
if (user->isSelf()) {
return false;
} else if (amCreator()) {
return true;
} else if (canNotEditLastAdmin(user)) {
} else if (!canEditLastAdmin(user)) {
return false;
}
return adminRights() & AdminRight::f_add_admins;
}
bool ChannelData::canRestrictUser(not_null<UserData*> user) const {
// Duplicated in ParticipantsBoxController::canRestrictUser :(
if (user->isSelf()) {
return false;
} else if (amCreator()) {
return true;
} else if (canNotEditLastAdmin(user)) {
} else if (!canEditLastAdmin(user)) {
return false;
}
return adminRights() & AdminRight::f_ban_users;