Browse Source

Fix orgs not being displayed on create repo form (#11279)

for-closed-social
Cirno the Strongest 4 years ago
committed by GitHub
parent
commit
b7c82cd1a9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 8 deletions
  1. +12
    -8
      routers/repo/repo.go

+ 12
- 8
routers/repo/repo.go View File

@ -62,6 +62,18 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
return nil 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. // Not equal means current user is an organization.
if uid == ctx.User.ID || uid == 0 { if uid == ctx.User.ID || uid == 0 {
return ctx.User return ctx.User
@ -83,14 +95,6 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
return nil return nil
} }
if !ctx.User.IsAdmin { 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) canCreate, err := org.CanCreateOrgRepo(ctx.User.ID)
if err != nil { if err != nil {
ctx.ServerError("CanCreateOrgRepo", err) ctx.ServerError("CanCreateOrgRepo", err)

Loading…
Cancel
Save