Fixup "Groups: Discussions"

Just forgot to add these two files to the commit :3
This commit is contained in:
Maxim Leshchenko 2021-12-15 00:48:09 +02:00
parent 356c782f74
commit e3a4c34574
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
2 changed files with 12 additions and 2 deletions

View file

@ -130,6 +130,11 @@ class Club extends RowModel
return $this->getRecord()->administrators_list_display; return $this->getRecord()->administrators_list_display;
} }
function isEveryoneCanCreateTopics(): bool
{
return (bool) $this->getRecord()->everyone_can_create_topics;
}
function getType(): int function getType(): int
{ {
return $this->getRecord()->type; return $this->getRecord()->type;

View file

@ -34,8 +34,13 @@ class Comment extends Post
*/ */
function getOwner(bool $honourFlags = true, bool $real = false): RowModel function getOwner(bool $honourFlags = true, bool $real = false): RowModel
{ {
if($honourFlags && $this->isPostedOnBehalfOfGroup() && $this->getTarget() instanceof Post) if($honourFlags && $this->isPostedOnBehalfOfGroup()) {
return (new Clubs)->get(abs($this->getTarget()->getTargetWall())); 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); return parent::getOwner($honourFlags, $real);
} }