Skip to content

Commit 0d2573c

Browse files
committed
Update Federated sharing notifier
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent ea2da1a commit 0d2573c

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

apps/federatedfilesharing/appinfo/app.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@
2929
$eventDispatcher = \OC::$server->getEventDispatcher();
3030

3131
$manager = \OC::$server->getNotificationManager();
32-
$manager->registerNotifier(function() {
33-
return \OC::$server->query(Notifier::class);
34-
}, function() {
35-
$l = \OC::$server->getL10N('files_sharing');
36-
return [
37-
'id' => 'files_sharing',
38-
'name' => $l->t('Federated sharing'),
39-
];
40-
});
32+
$manager->registerNotifier(Notifier::class);
4133

4234
$federatedShareProvider = $app->getFederatedShareProvider();
4335

apps/federatedfilesharing/lib/Notifier.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,33 @@ public function __construct(IFactory $factory, IManager $contactsManager, IURLGe
5959
$this->cloudIdManager = $cloudIdManager;
6060
}
6161

62+
/**
63+
* Identifier of the notifier, only use [a-z0-9_]
64+
*
65+
* @return string
66+
* @since 17.0.0
67+
*/
68+
public function getID(): string {
69+
return 'federatedfilesharing';
70+
}
71+
72+
/**
73+
* Human readable name describing the notifier
74+
*
75+
* @return string
76+
* @since 17.0.0
77+
*/
78+
public function getName(): string {
79+
return $this->factory->get('federatedfilesharing')->t('Federated sharing');
80+
}
81+
6282
/**
6383
* @param INotification $notification
6484
* @param string $languageCode The code of the language that should be used to prepare the notification
6585
* @return INotification
6686
* @throws \InvalidArgumentException
6787
*/
68-
public function prepare(INotification $notification, $languageCode) {
88+
public function prepare(INotification $notification, string $languageCode): INotification {
6989
if ($notification->getApp() !== 'files_sharing') {
7090
// Not my app => throw
7191
throw new \InvalidArgumentException();

0 commit comments

Comments
 (0)