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

Show channel members inside Info as well.

This commit is contained in:
John Preston
2017-11-17 20:06:20 +04:00
parent fc4c31b673
commit 4aae4f9399
4 changed files with 90 additions and 46 deletions

View File

@@ -879,6 +879,8 @@ void ChannelData::applyEditAdmin(not_null<UserData*> user, const MTPChannelAdmin
void ChannelData::applyEditBanned(not_null<UserData*> user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) {
auto flags = Notify::PeerUpdate::Flag::BannedUsersChanged | Notify::PeerUpdate::Flag::None;
auto isKicked = (newRights.c_channelBannedRights().vflags.v & MTPDchannelBannedRights::Flag::f_view_messages);
auto isRestricted = !isKicked && (newRights.c_channelBannedRights().vflags.v != 0);
if (mgInfo) {
if (mgInfo->lastAdmins.contains(user)) { // If rights are empty - still remove admin? TODO check
mgInfo->lastAdmins.remove(user);
@@ -888,8 +890,6 @@ void ChannelData::applyEditBanned(not_null<UserData*> user, const MTPChannelBann
flags |= Notify::PeerUpdate::Flag::AdminsChanged;
}
}
auto isKicked = (newRights.c_channelBannedRights().vflags.v & MTPDchannelBannedRights::Flag::f_view_messages);
auto isRestricted = !isKicked && (newRights.c_channelBannedRights().vflags.v != 0);
auto it = mgInfo->lastRestricted.find(user);
if (isRestricted) {
if (it == mgInfo->lastRestricted.cend()) {
@@ -927,6 +927,11 @@ void ChannelData::applyEditBanned(not_null<UserData*> user, const MTPChannelBann
Auth().data().removeMegagroupParticipant(this, user);
}
}
} else {
if (isKicked && membersCount() > 1) {
setMembersCount(membersCount() - 1);
flags |= Notify::PeerUpdate::Flag::MembersChanged;
}
}
Notify::peerUpdatedDelayed(this, flags);
}