Fixed showing hidden posts in /comments
If user has no privileges to list the hidden posts, comments on such posts won't show in /comments anymore.
This commit is contained in:
parent
9eee8ba612
commit
f59b92e06c
1 changed files with 4 additions and 1 deletions
|
@ -7,7 +7,10 @@ class CommentSearchService extends AbstractSearchService
|
|||
$stmt->addInnerJoin('post', new SqlEqualsOperator('post_id', 'post.id'));
|
||||
|
||||
$allowedSafety = PrivilegesHelper::getAllowedSafety();
|
||||
$stmt->setCriterion(SqlInOperator::fromArray('post.safety', SqlBinding::fromArray($allowedSafety)));
|
||||
$stmt->setCriterion(new SqlConjunction());
|
||||
$stmt->getCriterion()->add(SqlInOperator::fromArray('post.safety', SqlBinding::fromArray($allowedSafety)));
|
||||
if (!PrivilegesHelper::confirm(Privilege::ListPosts, 'hidden'))
|
||||
$stmt->getCriterion()->add(new SqlNegationOperator(new SqlStringExpression('hidden')));
|
||||
|
||||
$stmt->addOrderBy('comment.id', SqlSelectStatement::ORDER_DESC);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue