From e3a4c345742af821eed1600ae7bf20874817220f Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 15 Dec 2021 00:48:09 +0200 Subject: [PATCH] Fixup "Groups: Discussions" Just forgot to add these two files to the commit :3 --- Web/Models/Entities/Club.php | 5 +++++ Web/Models/Entities/Comment.php | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Web/Models/Entities/Club.php b/Web/Models/Entities/Club.php index 3aa91312..26748d73 100644 --- a/Web/Models/Entities/Club.php +++ b/Web/Models/Entities/Club.php @@ -130,6 +130,11 @@ class Club extends RowModel return $this->getRecord()->administrators_list_display; } + function isEveryoneCanCreateTopics(): bool + { + return (bool) $this->getRecord()->everyone_can_create_topics; + } + function getType(): int { return $this->getRecord()->type; diff --git a/Web/Models/Entities/Comment.php b/Web/Models/Entities/Comment.php index f9422761..884fdf47 100644 --- a/Web/Models/Entities/Comment.php +++ b/Web/Models/Entities/Comment.php @@ -34,8 +34,13 @@ class Comment extends Post */ function getOwner(bool $honourFlags = true, bool $real = false): RowModel { - if($honourFlags && $this->isPostedOnBehalfOfGroup() && $this->getTarget() instanceof Post) - return (new Clubs)->get(abs($this->getTarget()->getTargetWall())); + if($honourFlags && $this->isPostedOnBehalfOfGroup()) { + if($this->getTarget() instanceof Post) + return (new Clubs)->get(abs($this->getTarget()->getTargetWall())); + + if($this->getTarget() instanceof Topic) + return $this->getTarget()->getClub(); + } return parent::getOwner($honourFlags, $real); }