mirror of
				https://gitcode.com/gitea/gitea.git
				synced 2025-11-01 01:36:12 +08:00 
			
		
		
		
	Fix orgs not being displayed on create repo form (#11279)
This commit is contained in:
		 Cirno the Strongest
					Cirno the Strongest
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							ce66ca7f9f
						
					
				
				
					commit
					b7c82cd1a9
				
			| @ -62,6 +62,18 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	if !ctx.User.IsAdmin { | ||||
| 		orgsAvailable := []*models.User{} | ||||
| 		for i := 0; i < len(orgs); i++ { | ||||
| 			if orgs[i].CanCreateRepo() { | ||||
| 				orgsAvailable = append(orgsAvailable, orgs[i]) | ||||
| 			} | ||||
| 		} | ||||
| 		ctx.Data["Orgs"] = orgsAvailable | ||||
| 	} else { | ||||
| 		ctx.Data["Orgs"] = orgs | ||||
| 	} | ||||
|  | ||||
| 	// Not equal means current user is an organization. | ||||
| 	if uid == ctx.User.ID || uid == 0 { | ||||
| 		return ctx.User | ||||
| @ -83,14 +95,6 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User { | ||||
| 		return nil | ||||
| 	} | ||||
| 	if !ctx.User.IsAdmin { | ||||
| 		orgsAvailable := []*models.User{} | ||||
| 		for i := 0; i < len(orgs); i++ { | ||||
| 			if orgs[i].CanCreateRepo() { | ||||
| 				orgsAvailable = append(orgsAvailable, orgs[i]) | ||||
| 			} | ||||
| 		} | ||||
| 		ctx.Data["Orgs"] = orgsAvailable | ||||
|  | ||||
| 		canCreate, err := org.CanCreateOrgRepo(ctx.User.ID) | ||||
| 		if err != nil { | ||||
| 			ctx.ServerError("CanCreateOrgRepo", err) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user