@@ -32,53 +32,53 @@ |
||
32 | 32 | use OCP\Util; |
33 | 33 | |
34 | 34 | class Application extends App { |
35 | - public function __construct() { |
|
36 | - parent::__construct('updatenotification', []); |
|
37 | - } |
|
35 | + public function __construct() { |
|
36 | + parent::__construct('updatenotification', []); |
|
37 | + } |
|
38 | 38 | |
39 | - public function register() { |
|
40 | - $server = $this->getContainer()->getServer(); |
|
39 | + public function register() { |
|
40 | + $server = $this->getContainer()->getServer(); |
|
41 | 41 | |
42 | - if ($server->getConfig()->getSystemValue('updatechecker', true) !== true) { |
|
43 | - // Updater check is disabled |
|
44 | - return; |
|
45 | - } |
|
42 | + if ($server->getConfig()->getSystemValue('updatechecker', true) !== true) { |
|
43 | + // Updater check is disabled |
|
44 | + return; |
|
45 | + } |
|
46 | 46 | |
47 | - // Always register the notifier, so background jobs (without a user) can send push notifications |
|
48 | - $this->registerNotifier(); |
|
47 | + // Always register the notifier, so background jobs (without a user) can send push notifications |
|
48 | + $this->registerNotifier(); |
|
49 | 49 | |
50 | - $user = $server->getUserSession()->getUser(); |
|
51 | - if (!$user instanceof IUser) { |
|
52 | - // Nothing to do for guests |
|
53 | - return; |
|
54 | - } |
|
50 | + $user = $server->getUserSession()->getUser(); |
|
51 | + if (!$user instanceof IUser) { |
|
52 | + // Nothing to do for guests |
|
53 | + return; |
|
54 | + } |
|
55 | 55 | |
56 | - if (!$server->getAppManager()->isEnabledForUser('notifications') && |
|
57 | - $server->getGroupManager()->isAdmin($user->getUID())) { |
|
58 | - try { |
|
59 | - $updateChecker = $this->getContainer()->query(UpdateChecker::class); |
|
60 | - } catch (QueryException $e) { |
|
61 | - $server->getLogger()->logException($e); |
|
62 | - return; |
|
63 | - } |
|
56 | + if (!$server->getAppManager()->isEnabledForUser('notifications') && |
|
57 | + $server->getGroupManager()->isAdmin($user->getUID())) { |
|
58 | + try { |
|
59 | + $updateChecker = $this->getContainer()->query(UpdateChecker::class); |
|
60 | + } catch (QueryException $e) { |
|
61 | + $server->getLogger()->logException($e); |
|
62 | + return; |
|
63 | + } |
|
64 | 64 | |
65 | - if ($updateChecker->getUpdateState() !== []) { |
|
66 | - Util::addScript('updatenotification', 'legacy-notification'); |
|
67 | - \OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'populateJavaScriptVariables'); |
|
68 | - } |
|
69 | - } |
|
70 | - } |
|
65 | + if ($updateChecker->getUpdateState() !== []) { |
|
66 | + Util::addScript('updatenotification', 'legacy-notification'); |
|
67 | + \OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'populateJavaScriptVariables'); |
|
68 | + } |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - public function registerNotifier() { |
|
73 | - $notificationsManager = $this->getContainer()->getServer()->getNotificationManager(); |
|
74 | - $notificationsManager->registerNotifier(function() { |
|
75 | - return $this->getContainer()->query(Notifier::class); |
|
76 | - }, function() { |
|
77 | - $l = $this->getContainer()->getServer()->getL10N('updatenotification'); |
|
78 | - return [ |
|
79 | - 'id' => 'updatenotification', |
|
80 | - 'name' => $l->t('Update notifications'), |
|
81 | - ]; |
|
82 | - }); |
|
83 | - } |
|
72 | + public function registerNotifier() { |
|
73 | + $notificationsManager = $this->getContainer()->getServer()->getNotificationManager(); |
|
74 | + $notificationsManager->registerNotifier(function() { |
|
75 | + return $this->getContainer()->query(Notifier::class); |
|
76 | + }, function() { |
|
77 | + $l = $this->getContainer()->getServer()->getL10N('updatenotification'); |
|
78 | + return [ |
|
79 | + 'id' => 'updatenotification', |
|
80 | + 'name' => $l->t('Update notifications'), |
|
81 | + ]; |
|
82 | + }); |
|
83 | + } |
|
84 | 84 | } |