diff options
author | Florian Kaiser <florian.kaiser@fnkr.net> | 2016-01-31 13:28:42 +0000 |
---|---|---|
committer | Florian Kaiser <florian.kaiser@fnkr.net> | 2016-01-31 15:30:07 +0000 |
commit | e35791b2b2888979ba53b8a9a58e1cb132026914 (patch) | |
tree | 128e988ab9d46a56ae0448c068b23ed9a3b05d70 /routers | |
parent | 5eafe2b17eb9a1cf1068e7a3ed7a57a2730f04b0 (diff) | |
download | gitea-e35791b2b2888979ba53b8a9a58e1cb132026914.tar.gz gitea-e35791b2b2888979ba53b8a9a58e1cb132026914.zip |
Only show teams the user has access to
Diffstat (limited to 'routers')
-rw-r--r-- | routers/org/teams.go | 5 | ||||
-rw-r--r-- | routers/user/home.go | 9 |
2 files changed, 4 insertions, 10 deletions
diff --git a/routers/org/teams.go b/routers/org/teams.go index b2128baab6..63618b9858 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -28,10 +28,7 @@ func Teams(ctx *middleware.Context) { ctx.Data["Title"] = org.FullName ctx.Data["PageIsOrgTeams"] = true - if err := org.GetTeams(); err != nil { - ctx.Handle(500, "GetTeams", err) - return - } + // org.Teams is already loaded by middleware for _, t := range org.Teams { if err := t.GetMembers(); err != nil { ctx.Handle(500, "GetMembers", err) diff --git a/routers/user/home.go b/routers/user/home.go index b198e801d2..fabe7b1f31 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -312,9 +312,10 @@ func showOrgProfile(ctx *middleware.Context) { } org := ctx.Org.Organization + userId := ctx.User.Id ctx.Data["Title"] = org.FullName - if err := org.GetUserRepositories(ctx.User.Id); err != nil { + if err := org.GetUserRepositories(userId); err != nil { ctx.Handle(500, "GetUserRepositories", err) return } @@ -326,11 +327,7 @@ func showOrgProfile(ctx *middleware.Context) { } ctx.Data["Members"] = org.Members - if err := org.GetTeams(); err != nil { - ctx.Handle(500, "GetTeams", err) - return - } - ctx.Data["Teams"] = org.Teams + ctx.Data["Teams"] = org.Teams // already loaded by middleware ctx.HTML(200, ORG_HOME) } |