Skip to content

Commit 09503b0

Browse files
authored
Merge pull request #27316 from nextcloud/bugfix/noid/getNumberOfUnreadCommentsForObjects
Fix populating the array and closing the cursors
2 parents 8458495 + c0c5340 commit 09503b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/private/Comments/Manager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,16 +655,16 @@ public function getNumberOfUnreadCommentsForObjects(string $objectType, array $o
655655
$query->andWhere($query->expr()->eq('c.verb', $query->createNamedParameter($verb)));
656656
}
657657

658+
$unreadComments = array_fill_keys($objectIds, 0);
658659
foreach (array_chunk($objectIds, 1000) as $chunk) {
659660
$query->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
660-
$result = $query->execute();
661661

662-
$unreadComments += array_fill_keys($objectIds, 0);
662+
$result = $query->executeQuery();
663663
while ($row = $result->fetch()) {
664664
$unreadComments[$row['object_id']] = (int) $row['num_comments'];
665665
}
666+
$result->closeCursor();
666667
}
667-
$result->closeCursor();
668668

669669
return $unreadComments;
670670
}

0 commit comments

Comments
 (0)