diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fef68f2..686a4095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). used to render issue and pull request bodies. - Update bundled JavaScript dependencies to close the remaining high-severity advisories (dompurify, js-yaml, nanoid). +- Show the message of the dashboard widget again, `NcEmptyContent` no longer has the + `title` prop it was passed in. +- Ask users who did not connect a GitHub account to connect one in the dashboard widget, + instead of reporting an error and requesting the GitHub API without a token. ## 3.2.7 - 2026-08-18 diff --git a/lib/Controller/GithubAPIController.php b/lib/Controller/GithubAPIController.php index 4bdf38b5..0e7d8a34 100644 --- a/lib/Controller/GithubAPIController.php +++ b/lib/Controller/GithubAPIController.php @@ -36,6 +36,10 @@ public function __construct( */ #[NoAdminRequired] public function getNotifications(?string $since = null): DataResponse { + if (!$this->githubAPIService->isUserConnected($this->userId)) { + // the dashboard widget shows its "connect" prompt on 400 + return new DataResponse([], Http::STATUS_BAD_REQUEST); + } $result = $this->githubAPIService->getNotifications($this->userId, false, $since); if (isset($result['error'])) { $response = new DataResponse($result['error'], 401); diff --git a/lib/Service/GithubAPIService.php b/lib/Service/GithubAPIService.php index 12fc98b0..064c235b 100644 --- a/lib/Service/GithubAPIService.php +++ b/lib/Service/GithubAPIService.php @@ -45,6 +45,13 @@ public function __construct( $this->client = $clientService->newClient(); } + /** + * Whether the user connected a GitHub account, with OAuth or with a personal access token + */ + public function isUserConnected(string $userId): bool { + return $this->secretService->getEncryptedUserValue($userId, 'token') !== ''; + } + /** * Request an avatar image * @param string $userId diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 9bf81937..a2bc5f8e 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -13,7 +13,7 @@ @markRead="onMarkRead">