From 56660c3fd006a1c5ef84880fe35dd90a6fc7ee96 Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Wed, 10 Jun 2020 19:42:10 +0200 Subject: [PATCH] Use DEFAULT_PAGING_NUM instead of MAX_RESPONSE_ITEMS in ListOptions (#11831) (#11836) Co-authored-by: techknowlogick (cherry picked from commit 2b2b3e4c3726ef224e87bb444340bebd3a70badb) --- models/list_options.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/list_options.go b/models/list_options.go index 0946917fec..62c0944cc8 100644 --- a/models/list_options.go +++ b/models/list_options.go @@ -38,7 +38,10 @@ func (opts ListOptions) setEnginePagination(e Engine) Engine { } func (opts ListOptions) setDefaultValues() { - if opts.PageSize <= 0 || opts.PageSize > setting.API.MaxResponseItems { + if opts.PageSize <= 0 { + opts.PageSize = setting.API.DefaultPagingNum + } + if opts.PageSize > setting.API.MaxResponseItems { opts.PageSize = setting.API.MaxResponseItems } if opts.Page <= 0 {