aboutsummaryrefslogtreecommitdiffstats
path: root/routers/user/home.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/home.go')
-rw-r--r--routers/user/home.go34
1 files changed, 27 insertions, 7 deletions
diff --git a/routers/user/home.go b/routers/user/home.go
index db2fe84f91..66ee6570c0 100644
--- a/routers/user/home.go
+++ b/routers/user/home.go
@@ -114,15 +114,20 @@ func Dashboard(ctx *context.Context) {
var err error
var repos, mirrors []*models.Repository
if ctxUser.IsOrganization() {
- repos, _, err = ctxUser.GetUserRepositories(ctx.User.ID, 1, setting.UI.User.RepoPagingNum)
+ env, err := ctxUser.AccessibleReposEnv(ctx.User.ID)
if err != nil {
- ctx.Handle(500, "GetUserRepositories", err)
+ ctx.Handle(500, "AccessibleReposEnv", err)
+ return
+ }
+ repos, err = env.Repos(1, setting.UI.User.RepoPagingNum)
+ if err != nil {
+ ctx.Handle(500, "env.Repos", err)
return
}
- mirrors, err = ctxUser.GetUserMirrorRepositories(ctx.User.ID)
+ mirrors, err = env.MirrorRepos()
if err != nil {
- ctx.Handle(500, "GetUserMirrorRepositories", err)
+ ctx.Handle(500, "env.MirrorRepos", err)
return
}
} else {
@@ -205,7 +210,12 @@ func Issues(ctx *context.Context) {
var err error
var repos []*models.Repository
if ctxUser.IsOrganization() {
- repos, _, err = ctxUser.GetUserRepositories(ctx.User.ID, 1, ctxUser.NumRepos)
+ env, err := ctxUser.AccessibleReposEnv(ctx.User.ID)
+ if err != nil {
+ ctx.Handle(500, "AccessibleReposEnv", err)
+ return
+ }
+ repos, err = env.Repos(1, ctxUser.NumRepos)
if err != nil {
ctx.Handle(500, "GetRepositories", err)
return
@@ -353,9 +363,19 @@ func showOrgProfile(ctx *context.Context) {
err error
)
if ctx.IsSigned && !ctx.User.IsAdmin {
- repos, count, err = org.GetUserRepositories(ctx.User.ID, page, setting.UI.User.RepoPagingNum)
+ env, err := org.AccessibleReposEnv(ctx.User.ID)
+ if err != nil {
+ ctx.Handle(500, "AccessibleReposEnv", err)
+ return
+ }
+ repos, err = env.Repos(page, setting.UI.User.RepoPagingNum)
+ if err != nil {
+ ctx.Handle(500, "env.Repos", err)
+ return
+ }
+ count, err = env.CountRepos()
if err != nil {
- ctx.Handle(500, "GetUserRepositories", err)
+ ctx.Handle(500, "env.CountRepos", err)
return
}
ctx.Data["Repos"] = repos