From c3c129d923fdc79b1da386161445a7baa302e5ed Mon Sep 17 00:00:00 2001 From: Arunavo Ray Date: Mon, 7 Jul 2025 14:03:23 +0530 Subject: [PATCH] fix: enhance mirror strategy handling for mixed mode configuration --- src/components/config/GiteaConfigForm.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/config/GiteaConfigForm.tsx b/src/components/config/GiteaConfigForm.tsx index 6f6f5f9..aa0d331 100644 --- a/src/components/config/GiteaConfigForm.tsx +++ b/src/components/config/GiteaConfigForm.tsx @@ -27,6 +27,8 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g // Derive the mirror strategy from existing config for backward compatibility const getMirrorStrategy = (): MirrorStrategy => { if (config.mirrorStrategy) return config.mirrorStrategy; + // Check for mixed mode: when we have both organization and personalReposOrg defined + if (config.organization && config.personalReposOrg && !config.preserveOrgStructure) return "mixed"; if (config.preserveOrgStructure) return "preserve"; if (config.organization && config.organization !== config.username) return "single-org"; return "flat-user"; @@ -55,6 +57,16 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g newConfig.mirrorStrategy = "flat-user"; newConfig.organization = ""; break; + case "mixed": + newConfig.preserveOrgStructure = false; + newConfig.mirrorStrategy = "mixed"; + if (!newConfig.organization) { + newConfig.organization = "github-mirrors"; + } + if (!newConfig.personalReposOrg) { + newConfig.personalReposOrg = "github-personal"; + } + break; } setConfig(newConfig);