Fix owners cannot create organization repos bug (#20841) (#20854)

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>
pull/20856/head
zeripath 2 years ago committed by GitHub
parent 737486152c
commit 35ca651c80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      routers/api/v1/org/team.go
  2. 5
      routers/web/org/teams.go

@ -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 {

@ -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)

Loading…
Cancel
Save