From 3c83cd863ac5740290870a454e5512c283a16385 Mon Sep 17 00:00:00 2001 From: Jana Peper Date: Mon, 18 May 2026 09:36:04 +0200 Subject: [PATCH] fix: UnknownActivityException Signed-off-by: Jana Peper --- lib/Notification/Notifier.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 2f38de2a..299288e7 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -7,8 +7,8 @@ namespace OCA\Assistant\Notification; -use InvalidArgumentException; use OCA\Assistant\AppInfo\Application; +use OCP\Activity\Exceptions\UnknownActivityException; use OCP\App\IAppManager; use OCP\IURLGenerator; use OCP\L10N\IFactory; @@ -57,13 +57,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 InvalidArgumentException When the notification was not prepared by a notifier + * @throws UnknownActivityException 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 InvalidArgumentException(); + throw new UnknownActivityException(); } $l = $this->factory->get(Application::APP_ID, $languageCode); @@ -73,12 +73,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 InvalidArgumentException(); + throw new UnknownActivityException(); } $schedulingAppId = $params['appId']; $schedulingAppInfo = $this->appManager->getAppInfo($schedulingAppId); if ($schedulingAppInfo === null) { - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } $schedulingAppName = $schedulingAppInfo['name']; @@ -415,7 +415,7 @@ public function prepare(INotification $notification, string $languageCode): INot default: // Unknown subject => Unknown notification => throw - throw new InvalidArgumentException(); + throw new UnknownActivityException(); } } }