Skip to content

Commit 9d5db86

Browse files
committed
Updates to Org strategy
1 parent 3458891 commit 9d5db86

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

src/components/config/GiteaConfigForm.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g
4444
case "preserve":
4545
newConfig.preserveOrgStructure = true;
4646
newConfig.mirrorStrategy = "preserve";
47+
newConfig.personalReposOrg = undefined; // Clear personal repos org in preserve mode
4748
break;
4849
case "single-org":
4950
newConfig.preserveOrgStructure = false;
5051
newConfig.mirrorStrategy = "single-org";
51-
if (!newConfig.organization) {
52+
// Reset to default if coming from mixed mode where it was personal repos org
53+
if (config.mirrorStrategy === "mixed" || !newConfig.organization || newConfig.organization === "github-personal") {
5254
newConfig.organization = "github-mirrors";
5355
}
5456
break;
@@ -60,8 +62,10 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g
6062
case "mixed":
6163
newConfig.preserveOrgStructure = false;
6264
newConfig.mirrorStrategy = "mixed";
63-
if (!newConfig.organization) {
64-
newConfig.organization = "github-mirrors";
65+
// In mixed mode, organization field represents personal repos org
66+
// Reset it to default if coming from single-org mode
67+
if (config.mirrorStrategy === "single-org" || !newConfig.organization || newConfig.organization === "github-mirrors") {
68+
newConfig.organization = "github-personal";
6569
}
6670
if (!newConfig.personalReposOrg) {
6771
newConfig.personalReposOrg = "github-personal";

src/components/config/OrganizationConfiguration.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const OrganizationConfiguration: React.FC<OrganizationConfigurationProps>
104104
id="destinationOrg"
105105
value={destinationOrg || ""}
106106
onChange={(e) => onDestinationOrgChange(e.target.value)}
107-
placeholder="github-mirrors"
107+
placeholder={strategy === "mixed" ? "github-personal" : "github-mirrors"}
108108
className=""
109109
/>
110110
<p className="text-xs text-muted-foreground mt-1">
@@ -114,32 +114,6 @@ export const OrganizationConfiguration: React.FC<OrganizationConfigurationProps>
114114
}
115115
</p>
116116
</div>
117-
) : strategy === "preserve" ? (
118-
<div className="space-y-1">
119-
<Label htmlFor="personalReposOrg" className="text-sm font-normal flex items-center gap-2">
120-
Personal Repos Organization
121-
<TooltipProvider>
122-
<Tooltip>
123-
<TooltipTrigger>
124-
<Info className="h-3.5 w-3.5 text-muted-foreground" />
125-
</TooltipTrigger>
126-
<TooltipContent>
127-
<p>Override where your personal repositories are mirrored (leave empty to use your username)</p>
128-
</TooltipContent>
129-
</Tooltip>
130-
</TooltipProvider>
131-
</Label>
132-
<Input
133-
id="personalReposOrg"
134-
value={personalReposOrg || ""}
135-
onChange={(e) => onPersonalReposOrgChange(e.target.value)}
136-
placeholder="my-personal-mirrors"
137-
className=""
138-
/>
139-
<p className="text-xs text-muted-foreground mt-1">
140-
Override destination for your personal repos
141-
</p>
142-
</div>
143117
) : (
144118
<div className="hidden md:block" />
145119
)}

src/components/repositories/InlineDestinationEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export function InlineDestinationEditor({
4848
if (repository.organization) {
4949
return repository.organization;
5050
}
51-
// For personal repos, check if personalReposOrg is configured
52-
if (!repository.organization && giteaConfig?.personalReposOrg) {
51+
// For personal repos, check if personalReposOrg is configured (but not in preserve mode)
52+
if (!repository.organization && giteaConfig?.personalReposOrg && strategy !== 'preserve') {
5353
return giteaConfig.personalReposOrg;
5454
}
5555
// Default to the gitea username or owner

0 commit comments

Comments
 (0)