diff options
author | Unknwon <u@gogs.io> | 2017-02-15 05:39:36 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-15 05:39:36 -0500 |
commit | 4da325a45c453c8f895b0a215f548ce4d73d8462 (patch) | |
tree | c99109f8778f6e3d5e505569f6c1cb0d47bfee9d /routers/user | |
parent | fd5881fb645108738739be479c58fd4df3081fa8 (diff) |
user/profile: paging doesn't respect private repository count (#4082)
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/profile.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go index 3558e8b0..414425b2 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -99,9 +99,10 @@ func Profile(ctx *context.Context) { page = 1 } + showPrivate := ctx.IsSigned && (ctxUser.ID == ctx.User.ID || ctx.User.IsAdmin) ctx.Data["Repos"], err = models.GetUserRepositories(&models.UserRepoOptions{ UserID: ctxUser.ID, - Private: ctx.IsSigned && ctx.User.ID == ctxUser.ID, + Private: showPrivate, Page: page, PageSize: setting.UI.User.RepoPagingNum, }) @@ -109,7 +110,9 @@ func Profile(ctx *context.Context) { ctx.Handle(500, "GetRepositories", err) return } - ctx.Data["Page"] = paginater.New(ctxUser.NumRepos, setting.UI.User.RepoPagingNum, page, 5) + + count := models.CountUserRepositories(ctxUser.ID, showPrivate) + ctx.Data["Page"] = paginater.New(int(count), setting.UI.User.RepoPagingNum, page, 5) } ctx.HTML(200, PROFILE) |