From fb337b18a33b960725b4070a1a3c3fc85c1d7770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=B8vring?= Date: Fri, 10 Nov 2023 10:06:07 +0100 Subject: [PATCH 1/3] Fixes filename --- ...ryAccessReaderConfig.ts => CachingRepositoryAccessReader.ts} | 0 src/features/auth/domain/repositoryAccess/index.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/features/auth/domain/repositoryAccess/{CachingRepositoryAccessReaderConfig.ts => CachingRepositoryAccessReader.ts} (100%) diff --git a/src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReaderConfig.ts b/src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReader.ts similarity index 100% rename from src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReaderConfig.ts rename to src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReader.ts diff --git a/src/features/auth/domain/repositoryAccess/index.ts b/src/features/auth/domain/repositoryAccess/index.ts index 6ab0a1d6..1224c7b8 100644 --- a/src/features/auth/domain/repositoryAccess/index.ts +++ b/src/features/auth/domain/repositoryAccess/index.ts @@ -1,2 +1,2 @@ -export { default as CachingRepositoryAccessReader } from "./CachingRepositoryAccessReaderConfig" +export { default as CachingRepositoryAccessReader } from "./CachingRepositoryAccessReader" export { default as RepositoryRestrictingAccessTokenDataSource } from "./RepositoryRestrictingAccessTokenDataSource" From f76f34861c5706aa2e87ec3adaf9e894dd643cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=B8vring?= Date: Fri, 10 Nov 2023 10:18:59 +0100 Subject: [PATCH 2/3] Cancels creating access token when repository list empty --- .../auth/data/GitHubInstallationAccessTokenDataSource.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts b/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts index 7a958619..b82c2112 100644 --- a/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts +++ b/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts @@ -17,6 +17,9 @@ export default class GitHubInstallationAccessTokenRefresher { } async getAccessToken(repositoryNames: string[]): Promise { + if (repositoryNames.length == 0) { + throw new Error("Must provide at least one repository name when creating a GitHub installation access token.") + } const auth = createAppAuth({ appId: this.config.appId, clientId: this.config.clientId, From 8e8143c355d8f9d8c80e8e445664058647b4e3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=B8vring?= Date: Fri, 10 Nov 2023 10:19:24 +0100 Subject: [PATCH 3/3] Specializes error when repository list is empty --- .../auth/view/client/GuestAccessTokenInvalidPage.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx b/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx index 4293c9ef..1de0ce12 100644 --- a/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx +++ b/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx @@ -10,7 +10,6 @@ export default function GuestAccessTokenInvalidPage({ organizationName: string }) { const {repositories, isLoading, error} = useRepositoryAccess() - const title = "Could not obtain access" if (isLoading) { return ( @@ -20,15 +19,22 @@ export default function GuestAccessTokenInvalidPage({ } if (error) { return ( - + It was not possible to obtain access to the projects on the {organizationName} organization on GitHub. ) } + if (repositories.length == 0) { + return ( + + Your account does not have access to any projects. + + ) + } const repositoryNamesHTML = makeRepositoryNamesHTML(repositories) const html = `It was not possible to obtain access to all the projects: ${repositoryNamesHTML}.` return ( - +
)