2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Add a Reopen Topic button on topic top for admins.

This commit is contained in:
John Preston
2022-10-21 16:32:23 +04:00
parent 92bf925fd0
commit b497e5ea21
9 changed files with 222 additions and 70 deletions

View File

@@ -147,7 +147,8 @@ ForumTopic::ForumTopic(not_null<Forum*> forum, MsgId rootId)
history(),
rootId))
, _rootId(rootId)
, _lastKnownServerMessageId(rootId) {
, _lastKnownServerMessageId(rootId)
, _flags(creating() ? Flag::My : Flag()) {
Thread::setMuted(owner().notifySettings().isMuted(this));
_sendActionPainter->setTopic(this);
@@ -200,15 +201,19 @@ MsgId ForumTopic::rootId() const {
return _rootId;
}
bool ForumTopic::my() const {
return (_flags & Flag::My);
}
bool ForumTopic::canEdit() const {
return (_flags & Flag::My) || channel()->canEditTopics();
return my() || channel()->canEditTopics();
}
bool ForumTopic::canDelete() const {
return !creating()
&& (channel()->canEditTopics()
// We don't know if we can delete or not.
/*|| ((_flags & Flag::My) && onlyOneMyMessage)*/);
/*|| (my() && onlyOneMyMessage)*/);
}
bool ForumTopic::canToggleClosed() const {