Skip to content

Commit 1602e82

Browse files
committed
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>
1 parent f219ed2 commit 1602e82

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/updatenotification/lib/Controller/AdminController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function displayPanel() {
113113
'channels' => $channels,
114114
'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'],
115115
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
116-
'updaterEnabled' => $updateState['updaterEnabled'],
116+
'updaterEnabled' => (empty($updateState['updaterEnabled'])) ? false : $updateState['updaterEnabled'],
117117

118118
'notify_groups' => implode('|', $notifyGroups),
119119
];

apps/updatenotification/tests/Controller/AdminControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function testDisplayPanelWithoutUpdate() {
162162
$this->updateChecker
163163
->expects($this->once())
164164
->method('getUpdateState')
165-
->willReturn(['updaterEnabled' => false]);
165+
->willReturn([]);
166166

167167
$params = [
168168
'isNewVersionAvailable' => false,

0 commit comments

Comments
 (0)