diff options
author | Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> | 2020-05-03 23:08:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-03 18:08:24 -0300 |
commit | b7c82cd1a9ce4f863034a3a59312ff9402a8f72c (patch) | |
tree | c0ae975b778d1d59de56a44490e07ed1a3b5b0f0 | |
parent | ce66ca7f9f20ee69739e8800a4a629abbe9d25ac (diff) | |
download | gitea-b7c82cd1a9ce4f863034a3a59312ff9402a8f72c.tar.gz gitea-b7c82cd1a9ce4f863034a3a59312ff9402a8f72c.zip |
Fix orgs not being displayed on create repo form (#11279)
-rw-r--r-- | routers/repo/repo.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 994beef7af..b0bb608d09 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -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) |