Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(notifications): Remove share notification when the node is deleted
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Aug 3, 2023
commit c3acd03a8e0b5426743b0f64f011ba7baa3ddbe5
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