From 2b581814f334b7a79ef5e7a9fb31fc421c60a57c Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 9 Dec 2019 13:19:45 +0100 Subject: Add interface for notification handler for dimissed events Signed-off-by: Roeland Jago Douma --- lib/private/Notification/Manager.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/private') diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index 5d640c66be9..7791258d41a 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -31,6 +31,7 @@ use OCP\AppFramework\QueryException; use OCP\ILogger; use OCP\Notification\AlreadyProcessedException; use OCP\Notification\IApp; +use OCP\Notification\IDismissableNotifier; use OCP\Notification\IManager; use OCP\Notification\INotification; use OCP\Notification\INotifier; @@ -296,4 +297,18 @@ class Manager implements IManager { return $count; } + + public function dismissNotification(INotification $notification): void { + $notifiers = $this->getNotifiers(); + + foreach ($notifiers as $notifier) { + if ($notifier instanceof IDismissableNotifier) { + try { + $notifier->dismissNotification($notification); + } catch (\InvalidArgumentException $e) { + continue; + } + } + } + } } -- cgit v1.2.3