Skip to content

Commit 8d73de8

Browse files
committed
EditOrg: respect RepoAdminChangeTeamAccess (fix #16013)
1 parent bfe711e commit 8d73de8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

modules/structs/org.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ type CreateOrgOption struct {
3131
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
3232
}
3333

34+
// TODO: make EditOrgOption fields optional after https://gitea.com/go-chi/binding/pulls/5 got merged
35+
3436
// EditOrgOption options for editing an organization
3537
type EditOrgOption struct {
3638
FullName string `json:"full_name"`
@@ -40,5 +42,5 @@ type EditOrgOption struct {
4042
// possible values are `public`, `limited` or `private`
4143
// enum: public,limited,private
4244
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
43-
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
45+
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
4446
}

routers/api/v1/org/org.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,13 @@ func Edit(ctx *context.APIContext) {
264264
if form.Visibility != "" {
265265
org.Visibility = api.VisibilityModes[form.Visibility]
266266
}
267-
if err := models.UpdateUserCols(org, "full_name", "description", "website", "location", "visibility"); err != nil {
267+
if form.RepoAdminChangeTeamAccess != nil {
268+
org.RepoAdminChangeTeamAccess = *form.RepoAdminChangeTeamAccess
269+
}
270+
if err := models.UpdateUserCols(org,
271+
"full_name", "description", "website", "location",
272+
"visibility", "repo_admin_change_team_access",
273+
); err != nil {
268274
ctx.Error(http.StatusInternalServerError, "EditOrganization", err)
269275
return
270276
}

0 commit comments

Comments
 (0)