Skip to content

Commit 9844f8f

Browse files
authored
Merge pull request #552 from nextcloud/fix/UnknownActivityException
Fix: use UnknownNotificationException instead of Activity one
2 parents 6d45fc8 + 8ab0140 commit 9844f8f

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,14 +8,15 @@
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

1818
use OCP\Notification\INotifier;
19+
use OCP\Notification\UnknownNotificationException;
1920
use OCP\TaskProcessing\IManager as ITaskProcessingManager;
2021
use OCP\TaskProcessing\TaskTypes\AudioToText;
2122
use OCP\TaskProcessing\TaskTypes\TextToImage;
@@ -57,13 +58,13 @@ public function getName(): string {
5758
* @param INotification $notification
5859
* @param string $languageCode The code of the language that should be used to prepare the notification
5960
* @return INotification
60-
* @throws UnknownActivityException When the notification was not prepared by a notifier
61+
* @throws UnknownNotificationException When the notification was not prepared by a notifier
6162
* @since 9.0.0
6263
*/
6364
public function prepare(INotification $notification, string $languageCode): INotification {
6465
if ($notification->getApp() !== Application::APP_ID) {
6566
// Not my app => throw
66-
throw new UnknownActivityException();
67+
throw new UnknownNotificationException();
6768
}
6869

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

@@ -415,7 +416,7 @@ public function prepare(INotification $notification, string $languageCode): INot
415416

416417
default:
417418
// Unknown subject => Unknown notification => throw
418-
throw new UnknownActivityException();
419+
throw new UnknownNotificationException();
419420
}
420421
}
421422
}

0 commit comments

Comments
 (0)