@@ -83,7 +83,18 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
8383 ctx .Data ["PageIsTagList" ] = false
8484 }
8585
86- tags , err := ctx .Repo .GitRepo .GetTags ()
86+ listOptions := models.ListOptions {
87+ Page : ctx .FormInt ("page" ),
88+ PageSize : ctx .FormInt ("limit" ),
89+ }
90+ if listOptions .PageSize == 0 {
91+ listOptions .PageSize = setting .Repository .Release .DefaultPagingNum
92+ }
93+ if listOptions .PageSize > setting .API .MaxResponseItems {
94+ listOptions .PageSize = setting .API .MaxResponseItems
95+ }
96+
97+ tags , err := ctx .Repo .GitRepo .GetTags (listOptions .GetStartEnd ())
8798 if err != nil {
8899 ctx .ServerError ("GetTags" , err )
89100 return
@@ -92,19 +103,9 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
92103
93104 writeAccess := ctx .Repo .CanWrite (models .UnitTypeReleases )
94105 ctx .Data ["CanCreateRelease" ] = writeAccess && ! ctx .Repo .Repository .IsArchived
95- limit := ctx .FormInt ("limit" )
96- if limit == 0 {
97- limit = setting .Repository .Release .DefaultPagingNum
98- }
99- if limit > setting .API .MaxResponseItems {
100- limit = setting .API .MaxResponseItems
101- }
102106
103107 opts := models.FindReleasesOptions {
104- ListOptions : models.ListOptions {
105- Page : ctx .FormInt ("page" ),
106- PageSize : limit ,
107- },
108+ ListOptions : listOptions ,
108109 IncludeDrafts : writeAccess && ! isTagList ,
109110 IncludeTags : isTagList ,
110111 }
0 commit comments