mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
fix(comments): Use provided offset in best effort when loading comments
When we didn't find the "$lastKnownComment" the whole condition was ignored. Now 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. Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
cf7344082d
commit
4d2217073a
1 changed files with 16 additions and 0 deletions
|
|
@ -501,6 +501,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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue