mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 22:55:11 +00:00
Correctly handle complex pin_messages/manage_topics.
This commit is contained in:
@@ -210,10 +210,12 @@ bool ForumTopic::canEdit() const {
|
||||
}
|
||||
|
||||
bool ForumTopic::canDelete() const {
|
||||
return !creating()
|
||||
&& (channel()->canEditTopics()
|
||||
// We don't know if we can delete or not.
|
||||
/*|| (my() && onlyOneMyMessage)*/);
|
||||
if (creating()) {
|
||||
return false;
|
||||
} else if (channel()->canDeleteMessages()) {
|
||||
return true;
|
||||
}
|
||||
return my() && replies()->canDeleteMyTopic();
|
||||
}
|
||||
|
||||
bool ForumTopic::canToggleClosed() const {
|
||||
@@ -221,7 +223,12 @@ bool ForumTopic::canToggleClosed() const {
|
||||
}
|
||||
|
||||
bool ForumTopic::canTogglePinned() const {
|
||||
return !creating() && channel()->canEditTopics();
|
||||
if (creating()) {
|
||||
return false;
|
||||
}
|
||||
const auto channel = this->channel();
|
||||
return channel->amCreator()
|
||||
|| (channel->adminRights() & ChatAdminRight::PinMessagesOrTopics);
|
||||
}
|
||||
|
||||
bool ForumTopic::creating() const {
|
||||
|
Reference in New Issue
Block a user