Skip to content

Commit b33e3b5

Browse files
committed
feat(comments): Allow to filter by topmost parent id
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 345a0a0 commit b33e3b5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/private/Comments/Manager.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ public function getForObjectSince(
373373
string $sortDirection = 'asc',
374374
int $limit = 30,
375375
bool $includeLastKnown = false,
376+
string $topMostParentId = '',
376377
): array {
377378
return $this->getCommentsWithVerbForObjectSinceComment(
378379
$objectType,
@@ -381,7 +382,8 @@ public function getForObjectSince(
381382
$lastKnownCommentId,
382383
$sortDirection,
383384
$limit,
384-
$includeLastKnown
385+
$includeLastKnown,
386+
$topMostParentId,
385387
);
386388
}
387389

@@ -404,6 +406,7 @@ public function getCommentsWithVerbForObjectSinceComment(
404406
string $sortDirection = 'asc',
405407
int $limit = 30,
406408
bool $includeLastKnown = false,
409+
string $topMostParentId = '',
407410
): array {
408411
$comments = [];
409412

@@ -423,6 +426,13 @@ public function getCommentsWithVerbForObjectSinceComment(
423426
$query->andWhere($query->expr()->in('verb', $query->createNamedParameter($verbs, IQueryBuilder::PARAM_STR_ARRAY)));
424427
}
425428

429+
if ($topMostParentId !== '') {
430+
$query->andWhere($query->expr()->orX(
431+
$query->expr()->eq('id', $query->createNamedParameter($topMostParentId)),
432+
$query->expr()->eq('topmost_parent_id', $query->createNamedParameter($topMostParentId)),
433+
));
434+
}
435+
426436
$lastKnownComment = $lastKnownCommentId > 0 ? $this->getLastKnownComment(
427437
$objectType,
428438
$objectId,

0 commit comments

Comments
 (0)