diff options
Diffstat (limited to 'apps/updatenotification/appinfo')
-rw-r--r-- | apps/updatenotification/appinfo/app.php | 8 | ||||
-rw-r--r-- | apps/updatenotification/appinfo/application.php | 12 | ||||
-rw-r--r-- | apps/updatenotification/appinfo/routes.php | 1 |
3 files changed, 17 insertions, 4 deletions
diff --git a/apps/updatenotification/appinfo/app.php b/apps/updatenotification/appinfo/app.php index 9148b6e6ef7..f257cba6974 100644 --- a/apps/updatenotification/appinfo/app.php +++ b/apps/updatenotification/appinfo/app.php @@ -31,9 +31,11 @@ if(\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { $userObject = \OC::$server->getUserSession()->getUser(); if($userObject !== null) { - if(\OC::$server->getGroupManager()->isAdmin($userObject->getUID()) && $updateChecker->getUpdateState() !== []) { - \OCP\Util::addScript('updatenotification', 'notification'); - OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); + if(\OC::$server->getGroupManager()->isAdmin($userObject->getUID())) { + if($updateChecker->getUpdateState() !== []) { + \OCP\Util::addScript('updatenotification', 'notification'); + OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'getJavaScript'); + } \OC_App::registerAdmin('updatenotification', 'admin'); } } diff --git a/apps/updatenotification/appinfo/application.php b/apps/updatenotification/appinfo/application.php index ae3317c1b54..24c0a11af69 100644 --- a/apps/updatenotification/appinfo/application.php +++ b/apps/updatenotification/appinfo/application.php @@ -22,7 +22,9 @@ namespace OCA\UpdateNotification\AppInfo; use OC\AppFramework\Utility\TimeFactory; +use OC\Updater; use OCA\UpdateNotification\Controller\AdminController; +use OCA\UpdateNotification\UpdateChecker; use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; @@ -32,13 +34,21 @@ class Application extends App { $container = $this->getContainer(); $container->registerService('AdminController', function(IAppContainer $c) { + $updater = new \OC\Updater( + \OC::$server->getHTTPHelper(), + \OC::$server->getConfig(), + \OC::$server->getIntegrityCodeChecker() + ); return new AdminController( $c->query('AppName'), $c->query('Request'), $c->getServer()->getJobList(), $c->getServer()->getSecureRandom(), $c->getServer()->getConfig(), - new TimeFactory() + new TimeFactory(), + $c->getServer()->getL10N($c->query('AppName')), + new UpdateChecker($updater), + $c->getServer()->getDateTimeFormatter() ); }); } diff --git a/apps/updatenotification/appinfo/routes.php b/apps/updatenotification/appinfo/routes.php index 2cf43c89769..9021d381b1b 100644 --- a/apps/updatenotification/appinfo/routes.php +++ b/apps/updatenotification/appinfo/routes.php @@ -24,4 +24,5 @@ namespace OCA\UpdateNotification\AppInfo; $application = new Application(); $application->registerRoutes($this, ['routes' => [ ['name' => 'Admin#createCredentials', 'url' => '/credentials', 'verb' => 'GET'], + ['name' => 'Admin#setChannel', 'url' => '/channel', 'verb' => 'POST'], ]]); |