diff options
author | Joas Schilling <coding@schilljs.com> | 2019-04-12 13:48:53 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-07-15 15:12:43 +0200 |
commit | 44bc697a93309522cd955be32b4f469c526d268c (patch) | |
tree | 32ef669bccc85bec0e1630f1cbd0547ca7c3b720 /apps | |
parent | a386ecec8c75677942f489e9e94ddcca6a29a05e (diff) | |
download | nextcloud-server-44bc697a93309522cd955be32b4f469c526d268c.tar.gz nextcloud-server-44bc697a93309522cd955be32b4f469c526d268c.zip |
Update Federated sharing notifier
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/federatedfilesharing/appinfo/app.php | 10 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/Notifier.php | 22 |
2 files changed, 22 insertions, 10 deletions
diff --git a/apps/federatedfilesharing/appinfo/app.php b/apps/federatedfilesharing/appinfo/app.php index f941987365f..bd46f9824f2 100644 --- a/apps/federatedfilesharing/appinfo/app.php +++ b/apps/federatedfilesharing/appinfo/app.php @@ -29,15 +29,7 @@ $app = new \OCA\FederatedFileSharing\AppInfo\Application(); $eventDispatcher = \OC::$server->getEventDispatcher(); $manager = \OC::$server->getNotificationManager(); -$manager->registerNotifier(function() { - return \OC::$server->query(Notifier::class); -}, function() { - $l = \OC::$server->getL10N('files_sharing'); - return [ - 'id' => 'files_sharing', - 'name' => $l->t('Federated sharing'), - ]; -}); +$manager->registerNotifier(Notifier::class); $federatedShareProvider = $app->getFederatedShareProvider(); diff --git a/apps/federatedfilesharing/lib/Notifier.php b/apps/federatedfilesharing/lib/Notifier.php index 03491f20af6..02a46d65bba 100644 --- a/apps/federatedfilesharing/lib/Notifier.php +++ b/apps/federatedfilesharing/lib/Notifier.php @@ -60,12 +60,32 @@ class Notifier implements INotifier { } /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return 'federatedfilesharing'; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->factory->get('federatedfilesharing')->t('Federated sharing'); + } + + /** * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification * @throws \InvalidArgumentException */ - public function prepare(INotification $notification, $languageCode) { + public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'files_sharing') { // Not my app => throw throw new \InvalidArgumentException(); |