]> source.dussan.org Git - gitea.git/commitdiff
Use DEFAULT_PAGING_NUM instead of MAX_RESPONSE_ITEMS in ListOptions (#11831) (#11836)
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>
Wed, 10 Jun 2020 17:42:10 +0000 (19:42 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jun 2020 17:42:10 +0000 (13:42 -0400)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
(cherry picked from commit 2b2b3e4c3726ef224e87bb444340bebd3a70badb)

models/list_options.go

index 0946917fecf8472ee3955204cc1d8d077dcfede1..62c0944cc80c9b3c63976a0a97eeb923d8bcb9cd 100644 (file)
@@ -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 {