Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-03-18 11:22:16 +0300
committerJoas Schilling <coding@schilljs.com>2022-03-18 11:22:16 +0300
commitd05dca0c1c7f737f2b2dfc8c044a583b0a07c035 (patch)
tree5f1c43320b6c559100367e4271e6e2045ecef092 /lib
parentb0fbcccfe66474d79586001ce9509d346919ae74 (diff)
Simplify comment search in special casesbugfix/noid/simplify-comment-search-in-special-cases
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Comments/Manager.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 7c312b18f7d..384187accf3 100644
--- a/lib/private/Comments/Manager.php
+++ b/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)));
}