Skip to content

Commit

Permalink
Merge pull request #3299 from nextcloud/bugfix/noid/calendar-setting
Browse files Browse the repository at this point in the history
Return false instead of throwing when getting calendar setting
  • Loading branch information
Julien Veyssier authored Sep 7, 2021
2 parents 643302b + 021aa69 commit b9758a7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/Service/ConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b9758a7

Please sign in to comment.