summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-04 12:48:17 +0200
committerJoas Schilling <coding@schilljs.com>2016-10-04 12:49:27 +0200
commitb74c12c3f5719a168c00c66eb822741f4f8fff5f (patch)
treefd3c530248917a3c4cac2199b908dded6b242781 /apps/updatenotification/lib
parent14d226dc33d5ad6965f1d01197832abf83a0eeed (diff)
downloadnextcloud-server-b74c12c3f5719a168c00c66eb822741f4f8fff5f.tar.gz
nextcloud-server-b74c12c3f5719a168c00c66eb822741f4f8fff5f.zip
Use the readable version for notifications
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php12
-rw-r--r--apps/updatenotification/lib/Notification/Notifier.php8
2 files changed, 14 insertions, 6 deletions
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index 70cde58bcb4..29a7671de5c 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -99,7 +99,7 @@ class BackgroundJob extends TimedJob {
$status = $updater->check();
if (isset($status['version'])) {
$url = $this->urlGenerator->linkToRouteAbsolute('settings_admin') . '#updater';
- $this->createNotifications('core', $status['version'], $url);
+ $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;
}