Skip to content

Commit 07491dd

Browse files
committed
feat: Support extending the focused filter from applications
This adds support for selectors registered by applications to extend the DB query for focused activity filter. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 6b29d57 commit 07491dd

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

lib/Data.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,22 @@ public function get(GroupHelper $groupHelper, UserSettings $userSettings, string
317317
));
318318
// Filter out our own activity
319319
$query->andWhere($query->expr()->neq('user', $query->createNamedParameter($user)));
320-
$query->andWhere(
321-
$query->expr()->orX(
322-
// Affected object is one of our files
323-
$query->expr()->eq('m.mount_point', $query->createNamedParameter('/'.$user.'/')),
324-
// There is no affected object, so the activity affects our user directly
325-
$query->expr()->eq('object_type', $query->createNamedParameter('')),
326-
// Show all sharing related events
327-
$query->expr()->eq('app', $query->createNamedParameter('files_sharing')),
328-
)
329-
);
320+
$conditions = [
321+
// Affected object is one of our files
322+
$query->expr()->eq('m.mount_point', $query->createNamedParameter('/'.$user.'/')),
323+
// There is no affected object, so the activity affects our user directly
324+
$query->expr()->eq('object_type', $query->createNamedParameter('')),
325+
// Show all sharing related events
326+
$query->expr()->eq('app', $query->createNamedParameter('files_sharing')),
327+
];
328+
$activityFocusedSelectors = $this->activityManager->getActivityFocusedSelectors();
329+
foreach ($activityFocusedSelectors as $activityFocusedSelector) {
330+
array_push(
331+
$conditions,
332+
...$activityFocusedSelector->extendQuery($query, $user)
333+
);
334+
}
335+
$query->andWhere($query->expr()->orX(...$conditions));
330336
}
331337

332338
if ($activeFilter instanceof IFilter) {

0 commit comments

Comments
 (0)