diff options
author | Unknwon <u@gogs.io> | 2016-02-04 12:52:11 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-04 12:52:11 -0500 |
commit | 739d5aa1d32229769acbdf53bd99222d13441b47 (patch) | |
tree | 7ca9e508ade455e660ff29a0995b26cefd8b8816 /routers/user | |
parent | 04be8c0de5295f57e06e152e56c481b29b1076e5 (diff) | |
parent | c3ff476ed67b69431e96fce8e5a16450976701f6 (diff) | |
download | gitea-739d5aa1d32229769acbdf53bd99222d13441b47.tar.gz gitea-739d5aa1d32229769acbdf53bd99222d13441b47.zip |
Merge pull request #2530 from fnkr/hide-other-teams-repos-from-org-page
Hide other teams & repos from organization page
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/home.go | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/routers/user/home.go b/routers/user/home.go index b5df5e3679..61cda33be2 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -183,11 +183,18 @@ func Issues(ctx *middleware.Context) { isShowClosed := ctx.Query("state") == "closed" // Get repositories. - repos, err := models.GetRepositories(ctxUser.Id, true) - if err != nil { - ctx.Handle(500, "GetRepositories", err) - return + if ctxUser.IsOrganization() { + if err := ctxUser.GetUserRepositories(ctx.User.Id); err != nil { + ctx.Handle(500, "GetRepositories", err) + return + } + } else { + if err := ctxUser.GetRepositories(); err != nil { + ctx.Handle(500, "GetRepositories", err) + return + } } + repos := ctxUser.Repos allCount := 0 repoIDs := make([]int64, 0, len(repos)) @@ -314,23 +321,27 @@ func showOrgProfile(ctx *middleware.Context) { org := ctx.Org.Organization ctx.Data["Title"] = org.FullName - repos, err := models.GetRepositories(org.Id, ctx.IsSigned && (ctx.User.IsAdmin || org.IsOrgMember(ctx.User.Id))) - if err != nil { - ctx.Handle(500, "GetRepositories", err) - return + if ctx.IsSigned { + if err := org.GetUserRepositories(ctx.User.Id); err != nil { + ctx.Handle(500, "GetUserRepositories", err) + return + } + ctx.Data["Repos"] = org.Repos + } else { + repos, err := models.GetRepositories(org.Id, false) + if err != nil { + ctx.Handle(500, "GetRepositories", err) + return + } + ctx.Data["Repos"] = repos } - ctx.Data["Repos"] = repos - if err = org.GetMembers(); err != nil { + if err := org.GetMembers(); err != nil { ctx.Handle(500, "GetMembers", err) return } ctx.Data["Members"] = org.Members - if err = org.GetTeams(); err != nil { - ctx.Handle(500, "GetTeams", err) - return - } ctx.Data["Teams"] = org.Teams ctx.HTML(200, ORG_HOME) |