diff --git a/src/components/config/GiteaConfigForm.tsx b/src/components/config/GiteaConfigForm.tsx index 1391608..08f542d 100644 --- a/src/components/config/GiteaConfigForm.tsx +++ b/src/components/config/GiteaConfigForm.tsx @@ -44,11 +44,13 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g case "preserve": newConfig.preserveOrgStructure = true; newConfig.mirrorStrategy = "preserve"; + newConfig.personalReposOrg = undefined; // Clear personal repos org in preserve mode break; case "single-org": newConfig.preserveOrgStructure = false; newConfig.mirrorStrategy = "single-org"; - if (!newConfig.organization) { + // Reset to default if coming from mixed mode where it was personal repos org + if (config.mirrorStrategy === "mixed" || !newConfig.organization || newConfig.organization === "github-personal") { newConfig.organization = "github-mirrors"; } break; @@ -60,8 +62,10 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g case "mixed": newConfig.preserveOrgStructure = false; newConfig.mirrorStrategy = "mixed"; - if (!newConfig.organization) { - newConfig.organization = "github-mirrors"; + // In mixed mode, organization field represents personal repos org + // Reset it to default if coming from single-org mode + if (config.mirrorStrategy === "single-org" || !newConfig.organization || newConfig.organization === "github-mirrors") { + newConfig.organization = "github-personal"; } if (!newConfig.personalReposOrg) { newConfig.personalReposOrg = "github-personal"; diff --git a/src/components/config/OrganizationConfiguration.tsx b/src/components/config/OrganizationConfiguration.tsx index 594d9ac..6e4cf99 100644 --- a/src/components/config/OrganizationConfiguration.tsx +++ b/src/components/config/OrganizationConfiguration.tsx @@ -104,7 +104,7 @@ export const OrganizationConfiguration: React.FC id="destinationOrg" value={destinationOrg || ""} onChange={(e) => onDestinationOrgChange(e.target.value)} - placeholder="github-mirrors" + placeholder={strategy === "mixed" ? "github-personal" : "github-mirrors"} className="" />

@@ -114,32 +114,6 @@ export const OrganizationConfiguration: React.FC }

- ) : strategy === "preserve" ? ( -
- - onPersonalReposOrgChange(e.target.value)} - placeholder="my-personal-mirrors" - className="" - /> -

- Override destination for your personal repos -

-
) : (
)} diff --git a/src/components/repositories/InlineDestinationEditor.tsx b/src/components/repositories/InlineDestinationEditor.tsx index 951b399..8a9dc2a 100644 --- a/src/components/repositories/InlineDestinationEditor.tsx +++ b/src/components/repositories/InlineDestinationEditor.tsx @@ -48,8 +48,8 @@ export function InlineDestinationEditor({ if (repository.organization) { return repository.organization; } - // For personal repos, check if personalReposOrg is configured - if (!repository.organization && giteaConfig?.personalReposOrg) { + // For personal repos, check if personalReposOrg is configured (but not in preserve mode) + if (!repository.organization && giteaConfig?.personalReposOrg && strategy !== 'preserve') { return giteaConfig.personalReposOrg; } // Default to the gitea username or owner