Skip to content

Commit

Permalink
Merge pull request #39711 from nextcloud/backport/39689/stable26
Browse files Browse the repository at this point in the history
[stable26] fix(notifications): Remove share notification when the node is deleted
  • Loading branch information
nickvergessen committed Aug 16, 2023
2 parents eba8266 + 94f22e7 commit 297938a
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 297938a

Please sign in to comment.