Fix owners cannot create organization repos bug (#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: Gusted <williamzijl7@hotmail.com>
This commit is contained in:
		
					parent
					
						
							
								5d0f643461
							
						
					
				
			
			
				commit
				
					
						999392f6a5
					
				
			
		
					 2 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -262,7 +262,7 @@ func EditTeam(ctx *context.APIContext) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if form.CanCreateOrgRepo != nil {
 | 
						if form.CanCreateOrgRepo != nil {
 | 
				
			||||||
		team.CanCreateOrgRepo = *form.CanCreateOrgRepo
 | 
							team.CanCreateOrgRepo = team.IsOwnerTeam() || *form.CanCreateOrgRepo
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(form.Name) > 0 {
 | 
						if len(form.Name) > 0 {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -416,7 +416,11 @@ func EditTeamPost(ctx *context.Context) {
 | 
				
			||||||
			isIncludeAllChanged = true
 | 
								isIncludeAllChanged = true
 | 
				
			||||||
			t.IncludesAllRepositories = includesAllRepositories
 | 
								t.IncludesAllRepositories = includesAllRepositories
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							t.CanCreateOrgRepo = form.CanCreateOrgRepo
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							t.CanCreateOrgRepo = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Description = form.Description
 | 
						t.Description = form.Description
 | 
				
			||||||
	if t.AccessMode < perm.AccessModeAdmin {
 | 
						if t.AccessMode < perm.AccessModeAdmin {
 | 
				
			||||||
		units := make([]organization.TeamUnit, 0, len(unitPerms))
 | 
							units := make([]organization.TeamUnit, 0, len(unitPerms))
 | 
				
			||||||
| 
						 | 
					@ -433,7 +437,6 @@ func EditTeamPost(ctx *context.Context) {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	t.CanCreateOrgRepo = form.CanCreateOrgRepo
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ctx.HasError() {
 | 
						if ctx.HasError() {
 | 
				
			||||||
		ctx.HTML(http.StatusOK, tplTeamNew)
 | 
							ctx.HTML(http.StatusOK, tplTeamNew)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue