From 3537d80088286880cbf4ba24ac2795dead364253 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 5 Feb 2021 01:23:46 +0800 Subject: Fix bug about ListOptions and stars/watchers pagnation (#14556) * Fix bug about ListOptions and stars/watchers pagnation * fix unit test Co-authored-by: 6543 <6543@obermui.de> --- routers/repo/view.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'routers/repo/view.go') diff --git a/routers/repo/view.go b/routers/repo/view.go index 25d40c34d8..45f17dee44 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -713,7 +713,10 @@ func RenderUserCards(ctx *context.Context, total int, getter func(opts models.Li pager := context.NewPagination(total, models.ItemsPerPage, page, 5) ctx.Data["Page"] = pager - items, err := getter(models.ListOptions{Page: pager.Paginater.Current()}) + items, err := getter(models.ListOptions{ + Page: pager.Paginater.Current(), + PageSize: models.ItemsPerPage, + }) if err != nil { ctx.ServerError("getter", err) return @@ -744,6 +747,7 @@ func Stars(ctx *context.Context) { func Forks(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repos.forks") + // TODO: need pagination forks, err := ctx.Repo.Repository.GetForks(models.ListOptions{}) if err != nil { ctx.ServerError("GetForks", err) -- cgit v1.2.3