$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) {
$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();
}
throw new \InvalidArgumentException('Invalid subject');
}
-
}
/**
* @inheritDoc
*/
- public function prepare(INotification $notification, $languageCode) {
+ public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getApp() !== 'auth') {
// Not my app => throw
throw new InvalidArgumentException();
}
}
+ /**
+ * Identifier of the notifier, only use [a-z0-9_]
+ *
+ * @return string
+ * @since 17.0.0
+ */
+ public function getID(): string {
+ return 'auth';
+ }
+
+ /**
+ * Human readable name describing the notifier
+ *
+ * @return string
+ * @since 17.0.0
+ */
+ public function getName(): string {
+ return $this->factory->get('lib')->t('Authentication');
+ }
}