Show version to update to properly

Properly shows the version that will be updated to.
This commit is contained in:
Lukas Reschke 2016-03-05 21:58:58 +01:00
parent 0a5f34ab80
commit 17f5f19187
2 changed files with 6 additions and 3 deletions

View File

@ -99,12 +99,13 @@ class AdminController extends Controller {
if(($key = array_search($currentChannel, $channels)) !== false) {
unset($channels[$key]);
}
$updateState = $this->updateChecker->getUpdateState();
$params = [
'isNewVersionAvailable' => ($this->updateChecker->getUpdateState() === []) ? false : true,
'isNewVersionAvailable' => ($updateState === []) ? false : true,
'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'],
];
return new TemplateResponse($this->appName, 'admin', $params, '');

View File

@ -107,13 +107,14 @@ class AdminControllerTest extends TestCase {
$this->updateChecker
->expects($this->once())
->method('getUpdateState')
->willReturn(['foo' => 'bar']);
->willReturn(['updateVersion' => '8.1.2']);
$params = [
'isNewVersionAvailable' => true,
'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels,
'newVersionString' => '8.1.2',
];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');
@ -154,6 +155,7 @@ class AdminControllerTest extends TestCase {
'lastChecked' => 'LastCheckedReturnValue',
'currentChannel' => \OCP\Util::getChannel(),
'channels' => $channels,
'newVersionString' => '',
];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');