diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-07-17 20:22:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-17 20:22:03 +0200 |
commit | 5b604eaeaba7d5ee5dd12a92f37c9e8e7519c9c2 (patch) | |
tree | a507ff70a162b7c779a62faa1f341ec025539b9f /apps/twofactor_backupcodes/lib | |
parent | 782554d2acdfd48b322753500906e8b291035250 (diff) | |
parent | 594efca1e3b936d0d86f2d80ebf366980a425713 (diff) | |
download | nextcloud-server-5b604eaeaba7d5ee5dd12a92f37c9e8e7519c9c2.tar.gz nextcloud-server-5b604eaeaba7d5ee5dd12a92f37c9e8e7519c9c2.zip |
Merge pull request #15040 from nextcloud/feature/13980/push-for-deleted-notifications
Notifications overhaul
Diffstat (limited to 'apps/twofactor_backupcodes/lib')
-rw-r--r-- | apps/twofactor_backupcodes/lib/AppInfo/Application.php | 10 | ||||
-rw-r--r-- | apps/twofactor_backupcodes/lib/Notifications/Notifier.php | 23 |
2 files changed, 22 insertions, 11 deletions
diff --git a/apps/twofactor_backupcodes/lib/AppInfo/Application.php b/apps/twofactor_backupcodes/lib/AppInfo/Application.php index 041af037067..735ee091bd1 100644 --- a/apps/twofactor_backupcodes/lib/AppInfo/Application.php +++ b/apps/twofactor_backupcodes/lib/AppInfo/Application.php @@ -74,15 +74,7 @@ class Application extends App { $container = $this->getContainer(); /** @var IManager $manager */ $manager = $container->query(IManager::class); - $manager->registerNotifier( - function() use ($container) { - return $container->query(Notifier::class); - }, - function () use ($container) { - $l = $container->query(IL10N::class); - return ['id' => 'twofactor_backupcodes', 'name' => $l->t('Second-factor backup codes')]; - } - ); + $manager->registerNotifierService(Notifier::class); } public function deleteUser($params) { diff --git a/apps/twofactor_backupcodes/lib/Notifications/Notifier.php b/apps/twofactor_backupcodes/lib/Notifications/Notifier.php index e4e2bcebb68..ab83d8ee2de 100644 --- a/apps/twofactor_backupcodes/lib/Notifications/Notifier.php +++ b/apps/twofactor_backupcodes/lib/Notifications/Notifier.php @@ -42,7 +42,27 @@ class Notifier implements INotifier { $this->url = $url; } - public function prepare(INotification $notification, $languageCode) { + /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return 'twofactor_backupcodes'; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->factory->get('twofactor_backupcodes')->t('Second-factor backup codes'); + } + + public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'twofactor_backupcodes') { // Not my app => throw throw new \InvalidArgumentException(); @@ -70,5 +90,4 @@ class Notifier implements INotifier { throw new \InvalidArgumentException(); } } - } |