diff --git a/.gitignore b/.gitignore index 577b6d38c..9f2f521a4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ tests/.phpunit.result.cache vendor/ .php_cs.cache \.idea/ +settings.json diff --git a/docs/API.md b/docs/API.md index e81553e3b..9f96b5162 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1066,6 +1066,7 @@ Deck stores user and app configuration values globally and per board. The GET en | --- | --- | | calendar | Determines if the calendar/tasks integration through the CalDAV backend is enabled for the user (boolean) | | cardDetailsInModal | Determines if the bigger view is used (boolean) | +| cardIdBadge | Determines if the ID badges are displayed on cards (boolean) | | groupLimit | Determines if creating new boards is limited to certain groups of the instance. The resulting output is an array of group objects with the id and the displayname (Admin only)| ``` @@ -1079,6 +1080,7 @@ Deck stores user and app configuration values globally and per board. The GET en "data": { "calendar": true, "cardDetailsInModal": true, + "cardIdBadge": true, "groupLimit": [ { "id": "admin", @@ -1109,6 +1111,7 @@ Deck stores user and app configuration values globally and per board. The GET en | notify-due | `off`, `assigned` or `all` | | calendar | Boolean | | cardDetailsInModal | Boolean | +| cardIdBadge | Boolean | #### Example request diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index b5296a691..37121e5e7 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -71,6 +71,7 @@ public function getAll(): array { $data = [ 'calendar' => $this->isCalendarEnabled(), 'cardDetailsInModal' => $this->isCardDetailsInModal(), + 'cardIdBadge' => $this->isCardIdBadgeEnabled() ]; if ($this->groupManager->isAdmin($this->getUserId())) { $data['groupLimit'] = $this->get('groupLimit'); @@ -100,6 +101,11 @@ public function get(string $key) { return false; } return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', true); + case 'cardIdBadge': + if ($this->getUserId() === null) { + return false; + } + return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', false); } return false; } @@ -131,6 +137,16 @@ public function isCardDetailsInModal(int $boardId = null): bool { return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':cardDetailsInModal', $defaultState); } + public function isCardIdBadgeEnabled(): bool { + if ($this->getUserId() === null) { + return false; + } + $appConfigState = $this->config->getAppValue(Application::APP_ID, 'cardIdBadge', 'yes') === 'no'; + $defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', $appConfigState); + + return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', $defaultState); + } + public function set($key, $value) { if ($this->getUserId() === null) { throw new NoPermissionException('Must be logged in to set user config'); @@ -153,6 +169,10 @@ public function set($key, $value) { $this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', (string)$value); $result = $value; break; + case 'cardIdBadge': + $this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', (string)$value); + $result = $value; + break; case 'board': [$boardId, $boardConfigKey] = explode(':', $key); if ($boardConfigKey === 'notify-due' && !in_array($value, [self::SETTING_BOARD_NOTIFICATION_DUE_ALL, self::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED, self::SETTING_BOARD_NOTIFICATION_DUE_OFF], true)) { diff --git a/src/components/cards/CardBadges.vue b/src/components/cards/CardBadges.vue index d45c96f2d..28fe4b523 100644 --- a/src/components/cards/CardBadges.vue +++ b/src/components/cards/CardBadges.vue @@ -22,6 +22,7 @@