Skip to content

Commit

Permalink
Fix owners cannot create organization repos bug (go-gitea#20841)
Browse files Browse the repository at this point in the history
Backport go-gitea#20841

* Fix owners cannot create organization repos bug

* Fix api

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

Co-authored-by: Gusted <williamzijl7@hotmail.com>
  • Loading branch information
2 people authored and zeripath committed Aug 18, 2022
1 parent c40c753 commit 3bb3665
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion routers/api/v1/org/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion routers/web/org/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -433,7 +437,6 @@ func EditTeamPost(ctx *context.Context) {
return
}
}
t.CanCreateOrgRepo = form.CanCreateOrgRepo

if ctx.HasError() {
ctx.HTML(http.StatusOK, tplTeamNew)
Expand Down

0 comments on commit 3bb3665

Please sign in to comment.