File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,18 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
6262 return nil
6363 }
6464
65+ if ! ctx .User .IsAdmin {
66+ orgsAvailable := []* models.User {}
67+ for i := 0 ; i < len (orgs ); i ++ {
68+ if orgs [i ].CanCreateRepo () {
69+ orgsAvailable = append (orgsAvailable , orgs [i ])
70+ }
71+ }
72+ ctx .Data ["Orgs" ] = orgsAvailable
73+ } else {
74+ ctx .Data ["Orgs" ] = orgs
75+ }
76+
6577 // Not equal means current user is an organization.
6678 if uid == ctx .User .ID || uid == 0 {
6779 return ctx .User
@@ -83,14 +95,6 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
8395 return nil
8496 }
8597 if ! ctx .User .IsAdmin {
86- orgsAvailable := []* models.User {}
87- for i := 0 ; i < len (orgs ); i ++ {
88- if orgs [i ].CanCreateRepo () {
89- orgsAvailable = append (orgsAvailable , orgs [i ])
90- }
91- }
92- ctx .Data ["Orgs" ] = orgsAvailable
93-
9498 canCreate , err := org .CanCreateOrgRepo (ctx .User .ID )
9599 if err != nil {
96100 ctx .ServerError ("CanCreateOrgRepo" , err )
You can’t perform that action at this time.
0 commit comments