diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-21 09:47:40 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-10-21 09:47:40 +0200 |
commit | 6400221fbad5246c0bce88dc45895297ff1bb242 (patch) | |
tree | de68d40609beff67c5fbcce0a2977bb410d73c7c /lib/private/Comments | |
parent | d462439a6311dce60b8a89583af054f2ff120fac (diff) | |
download | nextcloud-server-6400221fbad5246c0bce88dc45895297ff1bb242.tar.gz nextcloud-server-6400221fbad5246c0bce88dc45895297ff1bb242.zip |
Less magic
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Comments')
-rw-r--r-- | lib/private/Comments/Manager.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 68542580fcf..4ea1a8076c1 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -435,7 +435,11 @@ class Manager implements ICommentsManager { if ($lastKnownComment instanceof IComment) { $lastKnownCommentDateTime = $lastKnownComment->getCreationDateTime(); if ($sortDirection === 'desc') { - $idComparison = $includeLastKnown ? 'lte' : 'lt'; + if ($includeLastKnown) { + $idComparison = $query->expr()->lte('id', $query->createNamedParameter($lastKnownCommentId)); + } else { + $idComparison = $query->expr()->lt('id', $query->createNamedParameter($lastKnownCommentId)); + } $query->andWhere( $query->expr()->orX( $query->expr()->lt( @@ -449,12 +453,16 @@ class Manager implements ICommentsManager { $query->createNamedParameter($lastKnownCommentDateTime, IQueryBuilder::PARAM_DATE), IQueryBuilder::PARAM_DATE ), - $query->expr()->$idComparison('id', $query->createNamedParameter($lastKnownCommentId)) + $idComparison ) ) ); } else { - $idComparison = $includeLastKnown ? 'gte' : 'gt'; + if ($includeLastKnown) { + $idComparison = $query->expr()->gte('id', $query->createNamedParameter($lastKnownCommentId)); + } else { + $idComparison = $query->expr()->gt('id', $query->createNamedParameter($lastKnownCommentId)); + } $query->andWhere( $query->expr()->orX( $query->expr()->gt( @@ -468,7 +476,7 @@ class Manager implements ICommentsManager { $query->createNamedParameter($lastKnownCommentDateTime, IQueryBuilder::PARAM_DATE), IQueryBuilder::PARAM_DATE ), - $query->expr()->$idComparison('id', $query->createNamedParameter($lastKnownCommentId)) + $idComparison ) ) ); |