Skip to content

Commit 3cd540a

Browse files
janepiebackportbot[bot]
authored andcommitted
fix: use UnknownNotificationException instead of Activity one
Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
1 parent 3dfb57c commit 3cd540a

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

lib/Notification/Notifier.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
namespace OCA\Assistant\Notification;
99

1010
use OCA\Assistant\AppInfo\Application;
11-
use OCP\Activity\Exceptions\UnknownActivityException;
11+
1212
use OCP\App\IAppManager;
1313
use OCP\IURLGenerator;
1414
use OCP\L10N\IFactory;
1515
use OCP\Notification\IAction;
1616
use OCP\Notification\INotification;
1717
use OCP\Notification\INotifier;
18+
use OCP\Notification\UnknownNotificationException;
1819
use OCP\TaskProcessing\IManager as ITaskProcessingManager;
1920
use OCP\TaskProcessing\TaskTypes\AudioToText;
2021
use OCP\TaskProcessing\TaskTypes\TextToImage;
@@ -56,13 +57,13 @@ public function getName(): string {
5657
* @param INotification $notification
5758
* @param string $languageCode The code of the language that should be used to prepare the notification
5859
* @return INotification
59-
* @throws UnknownActivityException When the notification was not prepared by a notifier
60+
* @throws UnknownNotificationException When the notification was not prepared by a notifier
6061
* @since 9.0.0
6162
*/
6263
public function prepare(INotification $notification, string $languageCode): INotification {
6364
if ($notification->getApp() !== Application::APP_ID) {
6465
// Not my app => throw
65-
throw new UnknownActivityException();
66+
throw new UnknownNotificationException();
6667
}
6768

6869
$l = $this->factory->get(Application::APP_ID, $languageCode);
@@ -72,12 +73,12 @@ public function prepare(INotification $notification, string $languageCode): INot
7273
if (in_array($notification->getSubject(), ['success', 'failure'], true)) {
7374
// ignore old notifications (before meta tasks were introduced)
7475
if (!isset($params['target'], $params['inputs'])) {
75-
throw new UnknownActivityException();
76+
throw new UnknownNotificationException();
7677
}
7778
$schedulingAppId = $params['appId'];
7879
$schedulingAppInfo = $this->appManager->getAppInfo($schedulingAppId);
7980
if ($schedulingAppInfo === null) {
80-
throw new UnknownActivityException();
81+
throw new UnknownNotificationException();
8182
}
8283
$schedulingAppName = $schedulingAppInfo['name'];
8384

@@ -331,7 +332,7 @@ public function prepare(INotification $notification, string $languageCode): INot
331332
return $notification;
332333
default:
333334
// Unknown subject => Unknown notification => throw
334-
throw new UnknownActivityException();
335+
throw new UnknownNotificationException();
335336
}
336337
}
337338
}

0 commit comments

Comments
 (0)