Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(notifications): Remove notifications of expired activities #1460

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading