Skip to content

Commit

Permalink
Merge pull request #39689 from nextcloud/bugfix/39135/remove-share-no…
Browse files Browse the repository at this point in the history
…tifications-for-deleted-nodes

fix(notifications): Remove share notification when the node is deleted
  • Loading branch information
nickvergessen authored Aug 4, 2023
2 parents 149ddf4 + c3acd03 commit f8bd676
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/files_sharing/lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
namespace OCA\Files_Sharing\Notification;

use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IURLGenerator;
Expand Down Expand Up @@ -117,6 +118,13 @@ public function prepare(INotification $notification, string $languageCode): INot
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 {
Expand Down

0 comments on commit f8bd676

Please sign in to comment.