Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +419 to +421
Copy link
Copy Markdown
Member

@delvh delvh Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, to save a line, you can do

t.CanCreateOrgRepo = t.IsOwnerTeam()
if !t.CanCreateOrgRepo {
...
t.CanCreateOrgRepo = form.CanCreateOrgRepo

above

}

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