From bfe9b05d69fe3dbd3d27df73e174fc02d3c78983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 6 Sep 2021 09:38:40 +0200 Subject: [PATCH] Return false instead of throwing when getting calendar integration setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/ConfigService.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index b36f0e607..0ca6ab178 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -73,16 +73,20 @@ class ConfigService { if (!$this->groupManager->isAdmin($this->userId)) { throw new NoPermissionException('You must be admin to get the group limit'); } - $result = $this->getGroupLimit(); - break; + return $this->getGroupLimit(); case 'calendar': - $result = (bool)$this->config->getUserValue($this->userId, Application::APP_ID, 'calendar', true); - break; + if ($this->userId === null) { + return false; + } + return (bool)$this->config->getUserValue($this->userId, Application::APP_ID, 'calendar', true); } - return $result; } public function isCalendarEnabled(int $boardId = null): bool { + if ($this->userId === null) { + return false; + } + $defaultState = (bool)$this->config->getUserValue($this->userId, Application::APP_ID, 'calendar', true); if ($boardId === null) { return $defaultState;