Skip to content
Snippets Groups Projects
Commit 30a70308 authored by Morris Jobke's avatar Morris Jobke Committed by GitHub
Browse files

Merge pull request #5957 from nextcloud/updatenotification-show-status

Show correct status in update notification
parents 45d080d7 7f2e9d10
No related branches found
No related tags found
No related merge requests found
...@@ -86,9 +86,8 @@ class AdminController extends Controller implements ISettings { ...@@ -86,9 +86,8 @@ class AdminController extends Controller implements ISettings {
* @return TemplateResponse * @return TemplateResponse
*/ */
public function displayPanel() { public function displayPanel() {
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime( $lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
$this->config->getAppValue('core', 'lastupdatedat') $lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
);
$channels = [ $channels = [
'daily', 'daily',
...@@ -108,6 +107,7 @@ class AdminController extends Controller implements ISettings { ...@@ -108,6 +107,7 @@ class AdminController extends Controller implements ISettings {
$params = [ $params = [
'isNewVersionAvailable' => !empty($updateState['updateAvailable']), 'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
'lastChecked' => $lastUpdateCheck, 'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel, 'currentChannel' => $currentChannel,
'channels' => $channels, 'channels' => $channels,
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
$isNewVersionAvailable = $_['isNewVersionAvailable']; $isNewVersionAvailable = $_['isNewVersionAvailable'];
/** @var string $newVersionString */ /** @var string $newVersionString */
$newVersionString = $_['newVersionString']; $newVersionString = $_['newVersionString'];
/** @var bool $isUpdateChecked */
$isUpdateChecked = $_['isUpdateChecked'];
/** @var string $lastCheckedDate */ /** @var string $lastCheckedDate */
$lastCheckedDate = $_['lastChecked']; $lastCheckedDate = $_['lastChecked'];
/** @var array $channels */ /** @var array $channels */
...@@ -22,6 +24,8 @@ ...@@ -22,6 +24,8 @@
<?php if (!empty($_['downloadLink'])) { ?> <?php if (!empty($_['downloadLink'])) { ?>
<a href="<?php p($_['downloadLink']); ?>" class="button<?php if ($_['updaterEnabled']) { p(' hidden'); } ?>"><?php p($l->t('Download now')) ?></a> <a href="<?php p($_['downloadLink']); ?>" class="button<?php if ($_['updaterEnabled']) { p(' hidden'); } ?>"><?php p($l->t('Download now')) ?></a>
<?php } ?> <?php } ?>
<?php } elseif (!$isUpdateChecked) { ?>
<?php p($l->t('The update check is not yet finished. Please refresh the page.')); ?>
<?php } else { ?> <?php } else { ?>
<?php p($l->t('Your version is up to date.')); ?> <?php p($l->t('Your version is up to date.')); ?>
<span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span> <span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span>
......
...@@ -120,6 +120,7 @@ class AdminControllerTest extends TestCase { ...@@ -120,6 +120,7 @@ class AdminControllerTest extends TestCase {
$params = [ $params = [
'isNewVersionAvailable' => true, 'isNewVersionAvailable' => true,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue', 'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(), 'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels, 'channels' => $channels,
...@@ -166,6 +167,7 @@ class AdminControllerTest extends TestCase { ...@@ -166,6 +167,7 @@ class AdminControllerTest extends TestCase {
$params = [ $params = [
'isNewVersionAvailable' => false, 'isNewVersionAvailable' => false,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue', 'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(), 'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels, 'channels' => $channels,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment