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

Show correct status in update notification
This commit is contained in:
Morris Jobke 2017-08-02 13:53:50 +02:00 committed by GitHub
commit 30a7030820
3 changed files with 9 additions and 3 deletions

View File

@ -86,9 +86,8 @@ class AdminController extends Controller implements ISettings {
* @return TemplateResponse
*/
public function displayPanel() {
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime(
$this->config->getAppValue('core', 'lastupdatedat')
);
$lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
$channels = [
'daily',
@ -108,6 +107,7 @@ class AdminController extends Controller implements ISettings {
$params = [
'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel,
'channels' => $channels,

View File

@ -6,6 +6,8 @@
$isNewVersionAvailable = $_['isNewVersionAvailable'];
/** @var string $newVersionString */
$newVersionString = $_['newVersionString'];
/** @var bool $isUpdateChecked */
$isUpdateChecked = $_['isUpdateChecked'];
/** @var string $lastCheckedDate */
$lastCheckedDate = $_['lastChecked'];
/** @var array $channels */
@ -22,6 +24,8 @@
<?php if (!empty($_['downloadLink'])) { ?>
<a href="<?php p($_['downloadLink']); ?>" class="button<?php if ($_['updaterEnabled']) { p(' hidden'); } ?>"><?php p($l->t('Download now')) ?></a>
<?php } ?>
<?php } elseif (!$isUpdateChecked) { ?>
<?php p($l->t('The update check is not yet finished. Please refresh the page.')); ?>
<?php } else { ?>
<?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>

View File

@ -120,6 +120,7 @@ class AdminControllerTest extends TestCase {
$params = [
'isNewVersionAvailable' => true,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels,
@ -166,6 +167,7 @@ class AdminControllerTest extends TestCase {
$params = [
'isNewVersionAvailable' => false,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels,