From 9c9dc5b5a4a6423cbd7479009ab2fa6b50c6fafd Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 11 Oct 2023 22:45:08 +0300 Subject: [PATCH] show events by user settings whitelist only --- src/Controller/UserController.php | 4 +++- src/Service/ActivityService.php | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 4bb1146..665efc0 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -57,7 +57,9 @@ class UserController extends AbstractController return $this->render( 'default/user/dashboard.html.twig', [ - 'activities' => $activityService->findLastActivities() + 'activities' => $activityService->findLastEvents( + $user->getEvents() + ) ] ); } diff --git a/src/Service/ActivityService.php b/src/Service/ActivityService.php index e0f48f3..1b11d8a 100644 --- a/src/Service/ActivityService.php +++ b/src/Service/ActivityService.php @@ -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' ]