Return false instead of throwing when getting calendar integration setting

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-09-06 09:38:40 +02:00
committed by Julien Veyssier
parent 643302be5e
commit 021aa698d9

View File

@@ -82,21 +82,18 @@ class ConfigService {
if ($this->getUserId() === null || !$this->groupManager->isAdmin($this->getUserId())) { if ($this->getUserId() === null || !$this->groupManager->isAdmin($this->getUserId())) {
throw new NoPermissionException('You must be admin to get the group limit'); throw new NoPermissionException('You must be admin to get the group limit');
} }
$result = $this->getGroupLimit(); return $this->getGroupLimit();
break;
case 'calendar': case 'calendar':
if ($this->getUserId() === null) { 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); return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true);
break;
} }
return $result;
} }
public function isCalendarEnabled(int $boardId = null): bool { public function isCalendarEnabled(int $boardId = null): bool {
if ($this->getUserId() === null) { 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); $defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true);