From 021aa698d9cfaa2642135d39fd97fb3a6d8cb3fc 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 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 9dae83aa4..e6b0d4b95 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -82,21 +82,18 @@ public function get($key) { if ($this->getUserId() === null || !$this->groupManager->isAdmin($this->getUserId())) { throw new NoPermissionException('You must be admin to get the group limit'); } - $result = $this->getGroupLimit(); - break; + return $this->getGroupLimit(); case 'calendar': if ($this->getUserId() === null) { - throw new NoPermissionException('Must be logged in to get the group limit'); + return false; } - $result = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true); - break; + return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true); } - return $result; } public function isCalendarEnabled(int $boardId = null): bool { if ($this->getUserId() === null) { - throw new NoPermissionException('Must be logged in to access user config'); + return false; } $defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true);