diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-09-20 10:23:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 10:23:47 +0200 |
commit | fe4d002d1f36ff668b26afd8c620910495245056 (patch) | |
tree | c38ea4238cf6b6c137fc4286b1d53eb62ff70c0c /lib | |
parent | 2be08904ed8d103deb23ccc8b6b331a2e0e2c78d (diff) | |
parent | 9cf4e38c4b588bbf88f38d7899b11de3637330ed (diff) | |
download | nextcloud-server-fe4d002d1f36ff668b26afd8c620910495245056.tar.gz nextcloud-server-fe4d002d1f36ff668b26afd8c620910495245056.zip |
Merge pull request #40506 from nextcloud/backport/40488/stable27
[stable27] fix(comments): Use provided offset in best effort when loading comments
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Comments/Manager.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 117318fb278..7847badd74b 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -548,6 +548,22 @@ class Manager implements ICommentsManager { ) ); } + } elseif ($lastKnownCommentId > 0) { + // We didn't find the "$lastKnownComment" but we still use the ID as an offset. + // This is required as a fall-back for expired messages in talk and deleted comments in other apps. + if ($sortDirection === 'desc') { + if ($includeLastKnown) { + $query->andWhere($query->expr()->lte('id', $query->createNamedParameter($lastKnownCommentId))); + } else { + $query->andWhere($query->expr()->lt('id', $query->createNamedParameter($lastKnownCommentId))); + } + } else { + if ($includeLastKnown) { + $query->andWhere($query->expr()->gte('id', $query->createNamedParameter($lastKnownCommentId))); + } else { + $query->andWhere($query->expr()->gt('id', $query->createNamedParameter($lastKnownCommentId))); + } + } } $resultStatement = $query->execute(); |