Browse Source

UpdateState is empty if no update is available

This leads to log messages such as "Undefined index: updaterEnabled at /media/psf/nextcloud/apps/updatenotification/lib/Controller/AdminController.php#116".

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
pull/1554/head
Lukas Reschke 9 years ago
parent
commit
1602e82363
No known key found for this signature in database GPG Key ID: B9F6980CF6E759B1
  1. 2
      apps/updatenotification/lib/Controller/AdminController.php
  2. 2
      apps/updatenotification/tests/Controller/AdminControllerTest.php

2
apps/updatenotification/lib/Controller/AdminController.php

@ -113,7 +113,7 @@ class AdminController extends Controller implements ISettings {
'channels' => $channels,
'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'],
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
'updaterEnabled' => $updateState['updaterEnabled'],
'updaterEnabled' => (empty($updateState['updaterEnabled'])) ? false : $updateState['updaterEnabled'],
'notify_groups' => implode('|', $notifyGroups),
];

2
apps/updatenotification/tests/Controller/AdminControllerTest.php

@ -162,7 +162,7 @@ class AdminControllerTest extends TestCase {
$this->updateChecker
->expects($this->once())
->method('getUpdateState')
->willReturn(['updaterEnabled' => false]);
->willReturn([]);
$params = [
'isNewVersionAvailable' => false,

Loading…
Cancel
Save