Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(notifications): Notifier::prepare() threw \InvalidArgumentExcepti… #475

Merged
merged 1 commit into from
Dec 23, 2024
Merged
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
6 changes: 3 additions & 3 deletions lib/Notifications/ExAppNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace OCA\AppAPI\Notifications;

use InvalidArgumentException;
use OCA\AppAPI\AppInfo\Application;
use OCA\AppAPI\Service\ExAppService;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use OCP\Notification\UnknownNotificationException;

class ExAppNotifier implements INotifier {

Expand All @@ -38,10 +38,10 @@ public function getName(): string {
public function prepare(INotification $notification, string $languageCode): INotification {
$exApp = $this->service->getExApp($notification->getApp());
if ($exApp === null) {
throw new InvalidArgumentException();
throw new UnknownNotificationException();
}
if (!$exApp->getEnabled()) { // Only enabled ExApps can render notifications
throw new InvalidArgumentException('ExApp is disabled');
throw new UnknownNotificationException('ExApp is disabled');
}

$l = $this->l10nFactory->get($notification->getApp(), $languageCode);
Expand Down
Loading