summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/milestone.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-08-12 14:43:08 +0200
committerGitHub <noreply@github.com>2021-08-12 14:43:08 +0200
commit2289580bb7ef8dfa4124c2b3bfb89897dbb35f46 (patch)
treee68aae604bb3d738b44156504a1415adaf042c68 /routers/web/repo/milestone.go
parentca13e1d56c561f72cf8ad251fe61b1898abfec51 (diff)
downloadgitea-2289580bb7ef8dfa4124c2b3bfb89897dbb35f46.tar.gz
gitea-2289580bb7ef8dfa4124c2b3bfb89897dbb35f46.zip
[API] generalize list header (#16551)
* Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
Diffstat (limited to 'routers/web/repo/milestone.go')
-rw-r--r--routers/web/repo/milestone.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go
index ca77e0976e..3ba27dd19a 100644
--- a/routers/web/repo/milestone.go
+++ b/routers/web/repo/milestone.go
@@ -53,17 +53,12 @@ func Milestones(ctx *context.Context) {
page = 1
}
- var total int
- var state structs.StateType
- if !isShowClosed {
- total = int(stats.OpenCount)
- state = structs.StateOpen
- } else {
- total = int(stats.ClosedCount)
+ state := structs.StateOpen
+ if isShowClosed {
state = structs.StateClosed
}
- miles, err := models.GetMilestones(models.GetMilestonesOption{
+ miles, total, err := models.GetMilestones(models.GetMilestonesOption{
ListOptions: models.ListOptions{
Page: page,
PageSize: setting.UI.IssuePagingNum,
@@ -106,7 +101,7 @@ func Milestones(ctx *context.Context) {
ctx.Data["Keyword"] = keyword
ctx.Data["IsShowClosed"] = isShowClosed
- pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5)
+ pager := context.NewPagination(int(total), setting.UI.IssuePagingNum, page, 5)
pager.AddParam(ctx, "state", "State")
pager.AddParam(ctx, "q", "Keyword")
ctx.Data["Page"] = pager