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

Handle migration to supergroups in boxes.

This commit is contained in:
John Preston
2019-01-14 10:34:51 +04:00
parent 3c44bdb6b7
commit 9728ddeaf9
29 changed files with 426 additions and 231 deletions

View File

@@ -212,17 +212,20 @@ void EditAdminBox::prepare() {
const auto chat = peer()->asChat();
const auto channel = peer()->asChannel();
const auto prepareRights = hadRights ? _oldRights : Defaults(peer());
const auto disabledByDefaults = DisabledByDefaultRestrictions(peer());
const auto filterByMyRights = canSave()
&& !hadRights
&& channel
&& !channel->amCreator();
const auto prepareFlags = prepareRights.c_chatAdminRights().vflags.v
& (filterByMyRights ? channel->adminRights() : ~Flag(0));
const auto prepareFlags = disabledByDefaults
| (prepareRights.c_chatAdminRights().vflags.v
& (filterByMyRights ? channel->adminRights() : ~Flag(0)));
const auto disabledFlags = canSave()
? ((!channel || channel->amCreator())
? Flags(0)
: ~channel->adminRights())
? (disabledByDefaults
| ((!channel || channel->amCreator())
? Flags(0)
: ~channel->adminRights()))
: ~Flags(0);
const auto anyoneCanAddMembers = chat