mirror of
https://github.com/gogs/gogs.git
synced 2025-05-29 10:42:30 +00:00
user/profile: paging doesn't respect private repository count (#4082)
This commit is contained in:
parent
fd5881fb64
commit
4da325a45c
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user