Simplify comment search in special cases

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/31614/head
Joas Schilling 4 years ago
parent b0fbcccfe6
commit d05dca0c1c
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
  1. 9
      lib/private/Comments/Manager.php

@ -611,13 +611,16 @@ class Manager implements ICommentsManager {
$query->select('*')
->from('comments')
->where($query->expr()->iLike('message', $query->createNamedParameter(
'%' . $this->dbConn->escapeLikeParameter($search). '%'
)))
->orderBy('creation_timestamp', 'DESC')
->addOrderBy('id', 'DESC')
->setMaxResults($limit);
if ($search !== '') {
$query->where($query->expr()->iLike('message', $query->createNamedParameter(
'%' . $this->dbConn->escapeLikeParameter($search). '%'
)));
}
if ($objectType !== '') {
$query->andWhere($query->expr()->eq('object_type', $query->createNamedParameter($objectType)));
}

Loading…
Cancel
Save