From 3213244294214a052f883f8eafdb6874d90bfd4a Mon Sep 17 00:00:00 2001 From: JustMarkDev Date: Sun, 14 Jun 2026 16:38:23 +0200 Subject: [PATCH] Fix Bitbucket source control availability toggle --- .../settings/SettingsPanels.browser.tsx | 44 +++++++++++++++++++ .../settings/SourceControlSettings.tsx | 7 +-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/settings/SettingsPanels.browser.tsx b/apps/web/src/components/settings/SettingsPanels.browser.tsx index a4cdc867f24..992df685862 100644 --- a/apps/web/src/components/settings/SettingsPanels.browser.tsx +++ b/apps/web/src/components/settings/SettingsPanels.browser.tsx @@ -1360,6 +1360,50 @@ describe("SourceControlSettingsPanel discovery states", () => { await expect.element(page.getByText("Nothing detected yet")).not.toBeInTheDocument(); }); + it("shows unauthenticated API providers as available but not enabled", async () => { + setSourceControlDiscoveryStub(async () => ({ + versionControlSystems: [], + sourceControlProviders: [ + { + kind: "bitbucket", + label: "Bitbucket", + status: "available", + version: Option.none(), + installHint: + "Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.", + detail: Option.none(), + auth: { + status: "unauthenticated", + account: Option.none(), + host: Option.some("bitbucket.org"), + detail: Option.some( + "Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.", + ), + }, + }, + ], + })); + + mounted = await render( + + + , + ); + + const bitbucketSwitch = page.getByRole("switch", { name: "Bitbucket availability" }); + + await expect.element(page.getByText("Not authenticated")).toBeInTheDocument(); + await expect + .element( + page.getByText( + "Available. Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.", + ), + ) + .toBeInTheDocument(); + await expect.element(bitbucketSwitch).toBeDisabled(); + await expect.element(bitbucketSwitch).not.toBeChecked(); + }); + it("shows Git fetch interval settings inside the Git details dropdown", async () => { setSourceControlDiscoveryStub(async () => ({ versionControlSystems: [ diff --git a/apps/web/src/components/settings/SourceControlSettings.tsx b/apps/web/src/components/settings/SourceControlSettings.tsx index 0cda0c1b869..00656f9fd2d 100644 --- a/apps/web/src/components/settings/SourceControlSettings.tsx +++ b/apps/web/src/components/settings/SourceControlSettings.tsx @@ -188,7 +188,7 @@ function itemSummary({ } if (!item.executable) { - return {item.installHint}; + return Available. {item.installHint}; } if (auth.status === "unauthenticated") { @@ -218,8 +218,9 @@ function DiscoveryItemRow({ readonly children?: ReactNode; }) { const version = optionLabel(item.version); - const enabled = - item.status === "available" && (isProviderDiscoveryItem(item) || item.implemented); + const enabled = isProviderDiscoveryItem(item) + ? item.status === "available" && item.auth.status === "authenticated" + : item.status === "available" && item.implemented; const auth = isProviderDiscoveryItem(item) ? item.auth : null; const authStatus = auth ? authPresentation(auth) : null; const authAccount = auth ? optionLabel(auth.account) : null;