mirror of https://github.com/procxx/kepka.git
Fix channel message pinning for channel moderators
The way of fixing this is weird and is a natural clutch. But we have to
live with it. And I hate it.
Note: all another function members movings from header file to source
are postponed to another commit.
This commit based on
75d8d01b17 (diff-efcc341e70654031bd8fee83d8b7105bR999)
Fixes #189.
This commit is contained in:
parent
04882ed746
commit
8b5f81a218
|
@ -922,6 +922,15 @@ void ChannelData::setPinnedMessageId(MsgId messageId) {
|
|||
}
|
||||
}
|
||||
|
||||
bool ChannelData::canPinMessages() const {
|
||||
if (isMegagroup()) {
|
||||
return (adminRights().is_pin_messages()) || amCreator();
|
||||
}
|
||||
// yes, you could pin messages in a channel if you have
|
||||
// "edit messages" permission.
|
||||
return (adminRights().is_edit_messages()) || amCreator();
|
||||
}
|
||||
|
||||
bool ChannelData::canNotEditLastAdmin(not_null<UserData *> user) const {
|
||||
if (mgInfo) {
|
||||
auto i = mgInfo->lastAdmins.constFind(user);
|
||||
|
|
|
@ -909,9 +909,6 @@ public:
|
|||
bool canAddAdmins() const {
|
||||
return adminRights().is_add_admins() || amCreator();
|
||||
}
|
||||
bool canPinMessages() const {
|
||||
return adminRights().is_pin_messages() || amCreator();
|
||||
}
|
||||
bool canPublish() const {
|
||||
return adminRights().is_post_messages() || amCreator();
|
||||
}
|
||||
|
@ -1004,6 +1001,8 @@ public:
|
|||
setPinnedMessageId(0);
|
||||
}
|
||||
|
||||
bool canPinMessages() const;
|
||||
|
||||
private:
|
||||
bool canNotEditLastAdmin(not_null<UserData *> user) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue