Update CommentLink.php (#5277)

The 2 last conditions (after the `||`) should be wrapped in parenthesis
This commit is contained in:
Marc Farré 2021-09-07 13:11:37 +02:00 committed by GitHub
parent c7b43d6206
commit dcde6f2282
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,11 +51,20 @@ 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,
@ -68,4 +77,3 @@ class CommentLink extends Widget
]);
}
}
}