]> source.dussan.org Git - gitea.git/commitdiff
Fix owners cannot create organization repos bug (#20841) (#20854)
authorzeripath <art27@cantab.net>
Thu, 18 Aug 2022 18:54:48 +0000 (19:54 +0100)
committerGitHub <noreply@github.com>
Thu, 18 Aug 2022 18:54:48 +0000 (14:54 -0400)
Backport #20841

* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
routers/api/v1/org/team.go
routers/web/org/teams.go

index f8c37303d67594fb0768226ce73950fcc4a0badd..db37bac57ec4924f6ecc0408d98212f22d06eb59 100644 (file)
@@ -262,7 +262,7 @@ func EditTeam(ctx *context.APIContext) {
        }
 
        if form.CanCreateOrgRepo != nil {
-               team.CanCreateOrgRepo = *form.CanCreateOrgRepo
+               team.CanCreateOrgRepo = team.IsOwnerTeam() || *form.CanCreateOrgRepo
        }
 
        if len(form.Name) > 0 {
index 284fb096f34059eb65729f82189e9ebd79cb33a4..9ee66a1a3e86c7e846bdf746ca9e8942ca935a05 100644 (file)
@@ -416,7 +416,11 @@ func EditTeamPost(ctx *context.Context) {
                        isIncludeAllChanged = true
                        t.IncludesAllRepositories = includesAllRepositories
                }
+               t.CanCreateOrgRepo = form.CanCreateOrgRepo
+       } else {
+               t.CanCreateOrgRepo = true
        }
+
        t.Description = form.Description
        if t.AccessMode < perm.AccessModeAdmin {
                units := make([]organization.TeamUnit, 0, len(unitPerms))
@@ -433,7 +437,6 @@ func EditTeamPost(ctx *context.Context) {
                        return
                }
        }
-       t.CanCreateOrgRepo = form.CanCreateOrgRepo
 
        if ctx.HasError() {
                ctx.HTML(http.StatusOK, tplTeamNew)