Skip to content

Commit

Permalink
Merge pull request #1859 from nextcloud/bugfix/noid/notification-hand…
Browse files Browse the repository at this point in the history
…ling

fix: prepare() threw \InvalidArgumentException which is deprecated
  • Loading branch information
nickvergessen authored Jan 21, 2025
2 parents bf7497a + cbe2002 commit 206733c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/NotificationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCP\Notification\IManager as NotificationManager;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use OCP\Notification\UnknownNotificationException;
use Psr\Log\LoggerInterface;

class NotificationGenerator implements INotifier {
Expand Down Expand Up @@ -101,15 +102,15 @@ public function getName(): string {

public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getObjectType() !== 'activity_notification') {
throw new \InvalidArgumentException();
throw new UnknownNotificationException();
}

$event = $this->data->getById((int)$notification->getObjectId());
if (!$event) {
throw new AlreadyProcessedException();
}
if ($event->getAffectedUser() !== $notification->getUser()) {
throw new \InvalidArgumentException();
throw new AlreadyProcessedException();
}
$this->activityManager->setCurrentUserId($notification->getUser());
$event = $this->populateEvent($event, $languageCode);
Expand Down

0 comments on commit 206733c

Please sign in to comment.