summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>2020-05-03 23:08:24 +0200
committerGitHub <noreply@github.com>2020-05-03 18:08:24 -0300
commitb7c82cd1a9ce4f863034a3a59312ff9402a8f72c (patch)
treec0ae975b778d1d59de56a44490e07ed1a3b5b0f0
parentce66ca7f9f20ee69739e8800a4a629abbe9d25ac (diff)
downloadgitea-b7c82cd1a9ce4f863034a3a59312ff9402a8f72c.tar.gz
gitea-b7c82cd1a9ce4f863034a3a59312ff9402a8f72c.zip
Fix orgs not being displayed on create repo form (#11279)
-rw-r--r--routers/repo/repo.go20
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)