authorgravatar for procopiomarco@protonmail.comJustMarkDev <procopiomarco@protonmail.com> 2026-06-14 16:38:23+02:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-06-14 11:07:19-07:00
log56e57de9478423becb33723a460eecf508fe1d5d
tree638768e1f9fc1247ed58ce5e0e7cdbbcb63cc1b9
parent3a0623f1cd7864aa21b49bdac03e57da876ed6ba

Fix Bitbucket source control availability toggle


2 files changed, 48 insertions(+), 3 deletions(-)

apps/web/src/components/settings/SettingsPanels.browser.tsx+44
...@@ -1360,6 +1360,50 @@ describe("SourceControlSettingsPanel discovery states", () => {...@@ -1360,6 +1360,50 @@ describe("SourceControlSettingsPanel discovery states", () => {
1360 await expect.element(page.getByText("Nothing detected yet")).not.toBeInTheDocument();1360 await expect.element(page.getByText("Nothing detected yet")).not.toBeInTheDocument();
1361 });1361 });
13621362
1363 it("shows unauthenticated API providers as available but not enabled", async () => {
1364 setSourceControlDiscoveryStub(async () => ({
1365 versionControlSystems: [],
1366 sourceControlProviders: [
1367 {
1368 kind: "bitbucket",
1369 label: "Bitbucket",
1370 status: "available",
1371 version: Option.none(),
1372 installHint:
1373 "Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.",
1374 detail: Option.none(),
1375 auth: {
1376 status: "unauthenticated",
1377 account: Option.none(),
1378 host: Option.some("bitbucket.org"),
1379 detail: Option.some(
1380 "Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.",
1381 ),
1382 },
1383 },
1384 ],
1385 }));
1386
1387 mounted = await render(
1388 <AppAtomRegistryProvider>
1389 <SourceControlSettingsPanel />
1390 </AppAtomRegistryProvider>,
1391 );
1392
1393 const bitbucketSwitch = page.getByRole("switch", { name: "Bitbucket availability" });
1394
1395 await expect.element(page.getByText("Not authenticated")).toBeInTheDocument();
1396 await expect
1397 .element(
1398 page.getByText(
1399 "Available. Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.",
1400 ),
1401 )
1402 .toBeInTheDocument();
1403 await expect.element(bitbucketSwitch).toBeDisabled();
1404 await expect.element(bitbucketSwitch).not.toBeChecked();
1405 });
1406
1363 it("shows Git fetch interval settings inside the Git details dropdown", async () => {1407 it("shows Git fetch interval settings inside the Git details dropdown", async () => {
1364 setSourceControlDiscoveryStub(async () => ({1408 setSourceControlDiscoveryStub(async () => ({
1365 versionControlSystems: [1409 versionControlSystems: [
apps/web/src/components/settings/SourceControlSettings.tsx+4-3
...@@ -188,7 +188,7 @@ function itemSummary({...@@ -188,7 +188,7 @@ function itemSummary({
188 }188 }
189189
190 if (!item.executable) {190 if (!item.executable) {
191 return <span>{item.installHint}</span>;191 return <span>Available. {item.installHint}</span>;
192 }192 }
193193
194 if (auth.status === "unauthenticated") {194 if (auth.status === "unauthenticated") {
...@@ -218,8 +218,9 @@ function DiscoveryItemRow({...@@ -218,8 +218,9 @@ function DiscoveryItemRow({
218 readonly children?: ReactNode;218 readonly children?: ReactNode;
219}) {219}) {
220 const version = optionLabel(item.version);220 const version = optionLabel(item.version);
221 const enabled =221 const enabled = isProviderDiscoveryItem(item)
222 item.status === "available" && (isProviderDiscoveryItem(item) || item.implemented);222 ? item.status === "available" && item.auth.status === "authenticated"
223 : item.status === "available" && item.implemented;
223 const auth = isProviderDiscoveryItem(item) ? item.auth : null;224 const auth = isProviderDiscoveryItem(item) ? item.auth : null;
224 const authStatus = auth ? authPresentation(auth) : null;225 const authStatus = auth ? authPresentation(auth) : null;
225 const authAccount = auth ? optionLabel(auth.account) : null;226 const authAccount = auth ? optionLabel(auth.account) : null;