aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-06-01 21:01:01 +0200
committerGitHub <noreply@github.com>2021-06-01 21:01:01 +0200
commit09503b02694845fc519f19585e264a4a5fa8ed52 (patch)
tree3f04996c445e4f2b5778abece0c764117ca72513
parent84584959b09ce3dbde04324154934e6c8eb1d1bd (diff)
parentc0c5340f4eebe790d6193cca46bc48fe7ce79f6d (diff)
downloadnextcloud-server-09503b02694845fc519f19585e264a4a5fa8ed52.tar.gz
nextcloud-server-09503b02694845fc519f19585e264a4a5fa8ed52.zip
Merge pull request #27316 from nextcloud/bugfix/noid/getNumberOfUnreadCommentsForObjects
Fix populating the array and closing the cursors
-rw-r--r--lib/private/Comments/Manager.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 8cd8fc57b3d..beaab9535ac 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -655,16 +655,16 @@ class Manager implements ICommentsManager {
$query->andWhere($query->expr()->eq('c.verb', $query->createNamedParameter($verb)));
}
+ $unreadComments = array_fill_keys($objectIds, 0);
foreach (array_chunk($objectIds, 1000) as $chunk) {
$query->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
- $result = $query->execute();
- $unreadComments += array_fill_keys($objectIds, 0);
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$unreadComments[$row['object_id']] = (int) $row['num_comments'];
}
+ $result->closeCursor();
}
- $result->closeCursor();
return $unreadComments;
}