mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Update CommentLink.php (#5277)
The 2 last conditions (after the `||`) should be wrapped in parenthesis
This commit is contained in:
parent
c7b43d6206
commit
dcde6f2282
@ -50,22 +50,30 @@ class CommentLink extends Widget
|
||||
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('comment');
|
||||
|
||||
if (
|
||||
!$module->canComment($this->object)
|
||||
|| (
|
||||
CommentModel::isSubComment($this->object)
|
||||
&& !$module->canComment($this->object->content->getPolymorphicRelation())
|
||||
)
|
||||
){
|
||||
return '';
|
||||
}
|
||||
|
||||
if (empty($this->mode)) {
|
||||
$this->mode = self::MODE_INLINE;
|
||||
}
|
||||
|
||||
if ($module->canComment($this->object) || CommentModel::isSubComment($this->object) && $module->canComment($this->object->content->getPolymorphicRelation())){
|
||||
return $this->render('link', [
|
||||
'id' => $this->object->getUniqueId(),
|
||||
'mode' => $this->mode,
|
||||
'objectModel' => get_class($this->object),
|
||||
'objectId' => $this->object->getPrimaryKey(),
|
||||
'commentCount' => CommentModel::GetCommentCount(get_class($this->object), $this->object->getPrimaryKey()),
|
||||
'isNestedComment' => ($this->object instanceof CommentModel),
|
||||
'comment' => $this->object,
|
||||
'module' => $module
|
||||
]);
|
||||
}
|
||||
return $this->render('link', [
|
||||
'id' => $this->object->getUniqueId(),
|
||||
'mode' => $this->mode,
|
||||
'objectModel' => get_class($this->object),
|
||||
'objectId' => $this->object->getPrimaryKey(),
|
||||
'commentCount' => CommentModel::GetCommentCount(get_class($this->object), $this->object->getPrimaryKey()),
|
||||
'isNestedComment' => ($this->object instanceof CommentModel),
|
||||
'comment' => $this->object,
|
||||
'module' => $module
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user