2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Correctly handle complex pin_messages/manage_topics.

This commit is contained in:
John Preston
2022-10-24 13:13:21 +04:00
parent 53beb6f562
commit 70e5f752ba
16 changed files with 135 additions and 53 deletions

View File

@@ -201,7 +201,7 @@ void ChannelData::setInviteLink(const QString &newInviteLink) {
bool ChannelData::canHaveInviteLink() const {
return amCreator()
|| (adminRights() & AdminRight::InviteUsers);
|| (adminRights() & AdminRight::InviteByLinkOrAdd);
}
void ChannelData::setLocation(const MTPChannelLocation &data) {
@@ -525,7 +525,11 @@ bool ChannelData::canDeleteMessages() const {
}
bool ChannelData::anyoneCanAddMembers() const {
return !(defaultRestrictions() & Restriction::InviteUsers);
return !(defaultRestrictions() & Restriction::AddParticipants);
}
bool ChannelData::anyoneCanPinMessages() const {
return !(defaultRestrictions() & Restriction::PinMessages);
}
bool ChannelData::hiddenPreHistory() const {
@@ -534,8 +538,8 @@ bool ChannelData::hiddenPreHistory() const {
bool ChannelData::canAddMembers() const {
return isMegagroup()
? !amRestricted(ChatRestriction::InviteUsers)
: ((adminRights() & AdminRight::InviteUsers) || amCreator());
? !amRestricted(ChatRestriction::AddParticipants)
: ((adminRights() & AdminRight::InviteByLinkOrAdd) || amCreator());
}
bool ChannelData::canSendPolls() const {