diff --git a/lib/Controller/EndpointController.php b/lib/Controller/EndpointController.php index ecd4ae7f..e1fae137 100644 --- a/lib/Controller/EndpointController.php +++ b/lib/Controller/EndpointController.php @@ -39,8 +39,10 @@ use OCP\IRequest; use OCP\IUser; use OCP\IUserSession; use OCP\L10N\IFactory; +use OCP\Notification\AlreadyProcessedException; use OCP\Notification\IAction; use OCP\Notification\IManager; +use OCP\Notification\IncompleteParsedNotificationException; use OCP\Notification\INotification; use OCP\UserStatus\IManager as IUserStatusManager; use OCP\UserStatus\IUserStatus; @@ -116,7 +118,8 @@ class EndpointController extends OCSController { /** @var INotification $notification */ try { $notification = $this->manager->prepare($notification, $language); - } catch (\InvalidArgumentException) { + } catch (AlreadyProcessedException|IncompleteParsedNotificationException|\InvalidArgumentException) { + // FIXME remove \InvalidArgumentException in Nextcloud 39 // The app was disabled, skip the notification continue; } @@ -170,7 +173,8 @@ class EndpointController extends OCSController { try { $notification = $this->manager->prepare($notification, $language); - } catch (\InvalidArgumentException $e) { + } catch (AlreadyProcessedException|IncompleteParsedNotificationException|\InvalidArgumentException) { + // FIXME remove \InvalidArgumentException in Nextcloud 39 // The app was disabled return new DataResponse(null, Http::STATUS_NOT_FOUND); } diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index 32755f24..5d74511a 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -38,8 +38,10 @@ use OCP\IUserManager; use OCP\L10N\IFactory; use OCP\Mail\IMailer; use OCP\Mail\IMessage; +use OCP\Notification\AlreadyProcessedException; use OCP\Notification\IAction; use OCP\Notification\IManager; +use OCP\Notification\IncompleteParsedNotificationException; use OCP\Notification\INotification; use OCP\Util; use Psr\Log\LoggerInterface; @@ -200,7 +202,8 @@ class MailNotifications { /** @var INotification $preparedNotification */ try { $preparedNotification = $this->manager->prepare($notification, $language); - } catch (\InvalidArgumentException $e) { + } catch (AlreadyProcessedException|IncompleteParsedNotificationException|\InvalidArgumentException) { + // FIXME remove \InvalidArgumentException in Nextcloud 39 // The app was disabled, skip the notification continue; } catch (\Exception $e) { diff --git a/lib/Push.php b/lib/Push.php index 91344c4c..43973b22 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -43,7 +43,9 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IUser; use OCP\L10N\IFactory; +use OCP\Notification\AlreadyProcessedException; use OCP\Notification\IManager as INotificationManager; +use OCP\Notification\IncompleteParsedNotificationException; use OCP\Notification\INotification; use OCP\UserStatus\IManager as IUserStatusManager; use OCP\UserStatus\IUserStatus; @@ -310,7 +312,8 @@ class Push { try { $this->notificationManager->setPreparingPushNotification(true); $notification = $this->notificationManager->prepare($notification, $language); - } catch (\InvalidArgumentException $e) { + } catch (AlreadyProcessedException|IncompleteParsedNotificationException|\InvalidArgumentException) { + // FIXME remove \InvalidArgumentException in Nextcloud 39 return; } finally { $this->notificationManager->setPreparingPushNotification(false);