2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

adding / removing lastParticipants / lastAdmins in supergroups on adding / removing users / admins

This commit is contained in:
John Preston
2016-03-14 09:10:24 +03:00
parent cab19a141f
commit b38163b026
3 changed files with 35 additions and 4 deletions

View File

@@ -633,15 +633,23 @@ void ApiWrap::kickParticipantDone(KickRequest kick, const MTPUpdates &result, mt
int32 i = kick.first->asChannel()->mgInfo->lastParticipants.indexOf(kick.second);
if (i >= 0) {
kick.first->asChannel()->mgInfo->lastParticipants.removeAt(i);
kick.first->asChannel()->mgInfo->lastAdmins.remove(kick.second);
}
kick.first->asChannel()->mgInfo->bots.remove(kick.second);
if (kick.first->asChannel()->count > 1) {
kick.first->asChannel()->count--;
--kick.first->asChannel()->count;
} else {
kick.first->asChannel()->mgInfo->lastParticipantsStatus |= MegagroupInfo::LastParticipantsCountOutdated;
kick.first->asChannel()->mgInfo->lastParticipantsCount = 0;
}
if (kick.first->asChannel()->mgInfo->lastAdmins.contains(kick.second)) {
kick.first->asChannel()->mgInfo->lastAdmins.remove(kick.second);
if (kick.first->asChannel()->adminsCount > 1) {
--kick.first->asChannel()->adminsCount;
}
}
kick.first->asChannel()->mgInfo->bots.remove(kick.second);
if (kick.first->asChannel()->mgInfo->bots.isEmpty() && kick.first->asChannel()->mgInfo->botStatus > 0) {
kick.first->asChannel()->mgInfo->botStatus = -1;
}
}
emit fullPeerUpdated(kick.first);
}