From 98df88950f2c5f09c2d983f95f7bc9a1b1344c1b Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 28 Sep 2016 12:29:02 +0200 Subject: [PATCH] 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". --- apps/updatenotification/lib/Controller/AdminController.php | 2 +- .../updatenotification/tests/Controller/AdminControllerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php index 56f41ebf3ee..0a867f1267c 100644 --- a/apps/updatenotification/lib/Controller/AdminController.php +++ b/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), ]; diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php index 336da09ec7a..e731b9fb428 100644 --- a/apps/updatenotification/tests/Controller/AdminControllerTest.php +++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php @@ -161,7 +161,7 @@ class AdminControllerTest extends TestCase { $this->updateChecker ->expects($this->once()) ->method('getUpdateState') - ->willReturn(['updaterEnabled' => false]); + ->willReturn([]); $params = [ 'isNewVersionAvailable' => false, -- 2.39.5