Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! fix: use stable route for comment search results
  • Loading branch information
kesselb committed Aug 21, 2025
commit a5fee4aa4ea224808dfd6da7d82d914cbd2174f9
9 changes: 5 additions & 4 deletions apps/comments/lib/Search/CommentsSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private function findCommentsBySearchQuery(ISearchQuery $query, Folder $userFold
$result = [];
$numComments = 50;
$offset = 0;
$limit = $numComments;

while (count($result) < $numComments) {
$comments = $this->commentsManager->search(
Expand All @@ -77,7 +78,7 @@ private function findCommentsBySearchQuery(ISearchQuery $query, Folder $userFold
'',
'comment',
$offset,
$numComments
$limit,
);

foreach ($comments as $comment) {
Expand Down Expand Up @@ -121,13 +122,13 @@ private function findCommentsBySearchQuery(ISearchQuery $query, Folder $userFold
$result[] = $searchResultEntry;
}

if (count($comments) < $numComments) {
if (count($comments) < $limit) {
// Didn't find more comments when we tried to get, so there are no more comments.
break;
}

$offset += $numComments;
$numComments = 50 - count($result);
$offset += $limit;
$limit = $numComments - count($result);
}

return $result;
Expand Down