summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-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)