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) { if(($key = array_search($currentChannel, $channels)) !== false) {
unset($channels[$key]); unset($channels[$key]);
} }
$updateState = $this->updateChecker->getUpdateState();
$params = [ $params = [
'isNewVersionAvailable' => ($this->updateChecker->getUpdateState() === []) ? false : true, 'isNewVersionAvailable' => ($updateState === []) ? false : true,
'lastChecked' => $lastUpdateCheck, 'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel, 'currentChannel' => $currentChannel,
'channels' => $channels, 'channels' => $channels,
'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'],
]; ];
return new TemplateResponse($this->appName, 'admin', $params, ''); return new TemplateResponse($this->appName, 'admin', $params, '');

View File

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