From 91ef485dc8fc8fd48db52c27ad1133462de3f482 Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Fri, 18 Sep 2026 09:13:42 +0000 Subject: [PATCH] fix: show the content of the dashboard widgets again The widgets rendered nothing, for three reasons that only show up one after the other: - data() read OCA.Theming.color, which Nextcloud no longer provides, and the resulting TypeError stopped the component from rendering. The value was not used anywhere, and neither was darkThemeColor, so both are removed. - The empty content message and the connect button were in the #desc slot, which NcEmptyContent no longer has. They now use the description prop and the action slot. - /notifications answered 200 with an empty list for users without a Jira account, so the widget reported no notifications instead of asking to connect one. It now answers 400 in that case, which the widget already treats as not connected. Signed-off-by: Oleksander Piskun --- CHANGELOG.md | 5 +++++ lib/Controller/JiraAPIController.php | 4 ++++ lib/Service/JiraAPIService.php | 8 ++++++++ src/views/Dashboard.vue | 8 +++----- tests/unit/Service/JiraAPIServiceTest.php | 25 +++++++++++++++++++++++ 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9674a61..a1f48f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added support for Nextcloud 36 +### Fixed + +- Show the content of the dashboard widgets again, they stayed empty because of an error when loading +- Ask users who did not connect a Jira account to connect one in the dashboard widgets, instead of telling them there are no notifications + ## 1.4.3 - 2026-07-27 ### Changed diff --git a/lib/Controller/JiraAPIController.php b/lib/Controller/JiraAPIController.php index c5b1ec7..e0ac1a0 100644 --- a/lib/Controller/JiraAPIController.php +++ b/lib/Controller/JiraAPIController.php @@ -56,6 +56,10 @@ public function getJiraAvatar(string $accountId = '', string $accountKey = ''): * @return DataResponse */ public function getNotifications(?string $since = null, bool $filterProjects = false): DataResponse { + if (!$this->jiraAPIService->isUserConnected($this->userId)) { + // the dashboard widget shows its "connect" prompt on 400 + return new DataResponse([], 400); + } $result = $this->jiraAPIService->getNotifications($this->userId, $since, 7, $filterProjects); if (!isset($result['error'])) { $response = new DataResponse($result); diff --git a/lib/Service/JiraAPIService.php b/lib/Service/JiraAPIService.php index 2d861c4..32cdae7 100644 --- a/lib/Service/JiraAPIService.php +++ b/lib/Service/JiraAPIService.php @@ -125,6 +125,14 @@ public function getJiraResources(string $userId): array { return ($resources && count($resources) > 0) ? $resources : []; } + /** + * Whether the user connected a Jira account, with OAuth for Jira Cloud or with basic auth for a self-hosted Jira + */ + public function isUserConnected(string $userId): bool { + return $this->config->getUserValue($userId, Application::APP_ID, 'token') !== '' + || $this->config->getUserValue($userId, Application::APP_ID, 'basic_auth_header') !== ''; + } + /** * @param string $userId * @param ?string $since diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 295f45e..8af5f90 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -10,12 +10,12 @@ :loading="state === 'loading'">