diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-10-04 17:12:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 17:12:10 +0200 |
commit | 7c20aa2d72f0bde3107ea2333ff3162e16d7b3e3 (patch) | |
tree | ec6b0acdb936f39b8c1a0f89f999dbfb79fac62c /apps/updatenotification/lib | |
parent | 3a0e06147c87cd881238e2e121f31183399f3bbf (diff) | |
parent | db57190e33f632f9da2e07eae9f610934b9f9282 (diff) | |
download | nextcloud-server-7c20aa2d72f0bde3107ea2333ff3162e16d7b3e3.tar.gz nextcloud-server-7c20aa2d72f0bde3107ea2333ff3162e16d7b3e3.zip |
Merge pull request #1617 from nextcloud/issue-1605-update-notification-readable-version
Update notification readable version (10.0.1 instead of 9.1.1.5)
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r-- | apps/updatenotification/lib/Notification/BackgroundJob.php | 14 | ||||
-rw-r--r-- | apps/updatenotification/lib/Notification/Notifier.php | 8 |
2 files changed, 15 insertions, 7 deletions
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php index 70cde58bcb4..3a1aa5e0f16 100644 --- a/apps/updatenotification/lib/Notification/BackgroundJob.php +++ b/apps/updatenotification/lib/Notification/BackgroundJob.php @@ -98,8 +98,8 @@ class BackgroundJob extends TimedJob { $status = $updater->check(); if (isset($status['version'])) { - $url = $this->urlGenerator->linkToRouteAbsolute('settings_admin') . '#updater'; - $this->createNotifications('core', $status['version'], $url); + $url = $this->urlGenerator->linkToRouteAbsolute('settings.AdminSettings.index') . '#updater'; + $this->createNotifications('core', $status['version'], $url, $status['versionstring']); } } @@ -123,8 +123,9 @@ class BackgroundJob extends TimedJob { * @param string $app * @param string $version * @param string $url + * @param string $visibleVersion */ - protected function createNotifications($app, $version, $url) { + protected function createNotifications($app, $version, $url, $visibleVersion = '') { $lastNotification = $this->config->getAppValue('updatenotification', $app, false); if ($lastNotification === $version) { // We already notified about this update @@ -139,9 +140,14 @@ class BackgroundJob extends TimedJob { $notification->setApp('updatenotification') ->setDateTime(new \DateTime()) ->setObject($app, $version) - ->setSubject('update_available') ->setLink($url); + if ($visibleVersion !== '') { + $notification->setSubject('update_available', ['version' => $visibleVersion]); + } else { + $notification->setSubject('update_available'); + } + foreach ($this->getUsersToNotify() as $uid) { $notification->setUser($uid); $this->notificationManager->notify($notification); diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php index 48ce31f7374..3e1bc94425f 100644 --- a/apps/updatenotification/lib/Notification/Notifier.php +++ b/apps/updatenotification/lib/Notification/Notifier.php @@ -66,9 +66,10 @@ class Notifier implements INotifier { $l = $this->l10NFactory->get('updatenotification', $languageCode); if ($notification->getObjectType() === 'core') { - $appName = $l->t('Nextcloud core'); - $this->updateAlreadyInstalledCheck($notification, $this->getCoreVersions()); + + $parameters = $notification->getSubjectParameters(); + $notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']])); } else { $appInfo = $this->getAppInfo($notification->getObjectType()); $appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name']; @@ -76,9 +77,10 @@ class Notifier implements INotifier { if (isset($this->appVersions[$notification->getObjectType()])) { $this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]); } + + $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()])); } - $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()])); return $notification; } |