From 64f67818bcc6cc61cc49b1a7c032f3db85b73c91 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 30 Apr 2019 12:08:22 +0200 Subject: Fix new core notifier Signed-off-by: Joas Schilling --- core/Application.php | 20 ++------------------ core/Notification/RemoveLinkSharesNotifier.php | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 20 deletions(-) (limited to 'core') diff --git a/core/Application.php b/core/Application.php index 9655a8e1a47..3a212f85472 100644 --- a/core/Application.php +++ b/core/Application.php @@ -65,24 +65,8 @@ class Application extends App { $eventDispatcher = $server->query(IEventDispatcher::class); $notificationManager = $server->getNotificationManager(); - $notificationManager->registerNotifier(function () use ($server) { - return new RemoveLinkSharesNotifier( - $server->getL10NFactory() - ); - }, function () { - return [ - 'id' => 'core', - 'name' => 'core', - ]; - }); - $notificationManager->registerNotifier(function () use ($server) { - return $server->query(AuthenticationNotifier::class); - }, function () { - return [ - 'id' => 'auth', - 'name' => 'authentication notifier', - ]; - }); + $notificationManager->registerNotifier(RemoveLinkSharesNotifier::class); + $notificationManager->registerNotifier(AuthenticationNotifier::class); $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, function (GenericEvent $event) use ($container) { diff --git a/core/Notification/RemoveLinkSharesNotifier.php b/core/Notification/RemoveLinkSharesNotifier.php index b77846c847e..b2e73aee237 100644 --- a/core/Notification/RemoveLinkSharesNotifier.php +++ b/core/Notification/RemoveLinkSharesNotifier.php @@ -36,7 +36,27 @@ class RemoveLinkSharesNotifier implements INotifier { $this->l10nFactory = $factory; } - public function prepare(INotification $notification, $languageCode): INotification { + /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return 'core'; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->l10nFactory->get('core')->t('Nextcloud Server'); + } + + public function prepare(INotification $notification, string $languageCode): INotification { if($notification->getApp() !== 'core') { throw new \InvalidArgumentException(); } @@ -51,5 +71,4 @@ class RemoveLinkSharesNotifier implements INotifier { throw new \InvalidArgumentException('Invalid subject'); } - } -- cgit v1.2.3