From: Joas Schilling Date: Thu, 3 Aug 2023 09:25:26 +0000 (+0200) Subject: fix(notifications): Remove share notification when the node is deleted X-Git-Tag: v28.0.0beta1~599^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F39689%2Fhead;p=nextcloud-server.git fix(notifications): Remove share notification when the node is deleted Signed-off-by: Joas Schilling --- diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index 455d0fd66fc..d339c484dd7 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -29,6 +29,7 @@ declare(strict_types=1); namespace OCA\Files_Sharing\Notification; use OCP\Files\IRootFolder; +use OCP\Files\NotFoundException; use OCP\IGroupManager; use OCP\IL10N; use OCP\IURLGenerator; @@ -117,6 +118,13 @@ class Notifier implements INotifier { throw new AlreadyProcessedException(); } + try { + $share->getNode(); + } catch (NotFoundException $e) { + // Node is already deleted, so discard the notification + throw new AlreadyProcessedException(); + } + if ($notification->getSubject() === 'expiresTomorrow') { $notification = $this->parseShareExpiration($share, $notification, $l); } else {