From 8ab0140e7557a15c4f331d598ae2838cfdf36db5 Mon Sep 17 00:00:00 2001 From: Jana Peper Date: Fri, 22 May 2026 14:18:39 +0200 Subject: [PATCH] fix: use UnknownNotificationException instead of Activity one Signed-off-by: Jana Peper --- lib/Notification/Notifier.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 299288e7..e5116ffa 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -8,7 +8,7 @@ namespace OCA\Assistant\Notification; use OCA\Assistant\AppInfo\Application; -use OCP\Activity\Exceptions\UnknownActivityException; + use OCP\App\IAppManager; use OCP\IURLGenerator; use OCP\L10N\IFactory; @@ -16,6 +16,7 @@ use OCP\Notification\INotification; use OCP\Notification\INotifier; +use OCP\Notification\UnknownNotificationException; use OCP\TaskProcessing\IManager as ITaskProcessingManager; use OCP\TaskProcessing\TaskTypes\AudioToText; use OCP\TaskProcessing\TaskTypes\TextToImage; @@ -57,13 +58,13 @@ public function getName(): string { * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification - * @throws UnknownActivityException When the notification was not prepared by a notifier + * @throws UnknownNotificationException When the notification was not prepared by a notifier * @since 9.0.0 */ public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_ID) { // Not my app => throw - throw new UnknownActivityException(); + throw new UnknownNotificationException(); } $l = $this->factory->get(Application::APP_ID, $languageCode); @@ -73,12 +74,12 @@ public function prepare(INotification $notification, string $languageCode): INot if (in_array($notification->getSubject(), ['success', 'failure'], true)) { // ignore old notifications (before meta tasks were introduced) if (!isset($params['target'], $params['inputs'])) { - throw new UnknownActivityException(); + throw new UnknownNotificationException(); } $schedulingAppId = $params['appId']; $schedulingAppInfo = $this->appManager->getAppInfo($schedulingAppId); if ($schedulingAppInfo === null) { - throw new UnknownActivityException(); + throw new UnknownNotificationException(); } $schedulingAppName = $schedulingAppInfo['name']; @@ -415,7 +416,7 @@ public function prepare(INotification $notification, string $languageCode): INot default: // Unknown subject => Unknown notification => throw - throw new UnknownActivityException(); + throw new UnknownNotificationException(); } } }