From 1c9fe02705a22005c3491868529b54d98b29c382 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 12 Dec 2023 09:03:03 +0100 Subject: [PATCH] fix(notifications): Remove notifications of expired activities Signed-off-by: Joas Schilling --- lib/NotificationGenerator.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/NotificationGenerator.php b/lib/NotificationGenerator.php index 46618dbfb..678b91e4d 100644 --- a/lib/NotificationGenerator.php +++ b/lib/NotificationGenerator.php @@ -26,6 +26,7 @@ use OCP\Activity\IEvent; use OCP\Activity\IManager as ActivityManager; use OCP\IL10N; +use OCP\Notification\AlreadyProcessedException; use OCP\Notification\IManager as NotificationManager; use OCP\Notification\INotification; use OCP\Notification\INotifier; @@ -111,7 +112,10 @@ public function prepare(INotification $notification, string $languageCode): INot } $event = $this->data->getById((int)$notification->getObjectId()); - if (!$event || $event->getAffectedUser() !== $notification->getUser()) { + if (!$event) { + throw new AlreadyProcessedException(); + } + if ($event->getAffectedUser() !== $notification->getUser()) { throw new \InvalidArgumentException(); } $this->activityManager->setCurrentUserId($notification->getUser());