show events by user settings whitelist only

This commit is contained in:
ghost 2023-10-11 22:45:08 +03:00
parent 7aa2c03abc
commit 9c9dc5b5a4
2 changed files with 9 additions and 3 deletions

View File

@ -57,7 +57,9 @@ class UserController extends AbstractController
return $this->render(
'default/user/dashboard.html.twig',
[
'activities' => $activityService->findLastActivities()
'activities' => $activityService->findLastEvents(
$user->getEvents()
)
]
);
}

View File

@ -360,12 +360,16 @@ class ActivityService
return $events;
}
public function findLastActivities(): array
public function findLastEvents(
array $whitelist
): array
{
return $this->entityManagerInterface
->getRepository(Activity::class)
->findBy(
[],
[
'event' => $whitelist
],
[
'id' => 'DESC'
]