Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
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;
use OCP\Notification\IAction;
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;
Expand Down Expand Up @@ -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);
Expand All @@ -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'];

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

default:
// Unknown subject => Unknown notification => throw
throw new UnknownActivityException();
throw new UnknownNotificationException();
}
}
}
Loading