Skip to content

Commit

Permalink
fix(notifications): Remove notifications of expired activities
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Dec 12, 2023
1 parent 8bde919 commit 1c9fe02
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/NotificationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 1c9fe02

Please sign in to comment.