Skip to content

Commit 555b828

Browse files
lunnyGusted
authored and
Sysoev, Vladimir
committed
Fix owners cannot create organization repos bug (go-gitea#20841)
* Fix owners cannot create organization repos bug * Fix api * Update routers/api/v1/org/team.go Co-authored-by: Gusted <[email protected]> Co-authored-by: Gusted <[email protected]>
1 parent 09e4a59 commit 555b828

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

routers/api/v1/org/team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func EditTeam(ctx *context.APIContext) {
262262
}
263263

264264
if form.CanCreateOrgRepo != nil {
265-
team.CanCreateOrgRepo = *form.CanCreateOrgRepo
265+
team.CanCreateOrgRepo = team.IsOwnerTeam() || *form.CanCreateOrgRepo
266266
}
267267

268268
if len(form.Name) > 0 {

routers/web/org/teams.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,11 @@ func EditTeamPost(ctx *context.Context) {
416416
isIncludeAllChanged = true
417417
t.IncludesAllRepositories = includesAllRepositories
418418
}
419+
t.CanCreateOrgRepo = form.CanCreateOrgRepo
420+
} else {
421+
t.CanCreateOrgRepo = true
419422
}
423+
420424
t.Description = form.Description
421425
if t.AccessMode < perm.AccessModeAdmin {
422426
units := make([]organization.TeamUnit, 0, len(unitPerms))
@@ -433,7 +437,6 @@ func EditTeamPost(ctx *context.Context) {
433437
return
434438
}
435439
}
436-
t.CanCreateOrgRepo = form.CanCreateOrgRepo
437440

438441
if ctx.HasError() {
439442
ctx.HTML(http.StatusOK, tplTeamNew)

0 commit comments

Comments
 (0)