From c0bb5ebc15d3b5ace434a9d7e4b19a1af9ea4b40 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 29 Dec 2019 07:54:25 +0800 Subject: [PATCH] Fix repository issues pagination bug when there are more than one label filter (#9512) (#9528) * Fix repository issues pagination bug when there are more than one label filter (#9512) * fix merge --- modules/templates/helper.go | 8 ++++++++ routers/repo/issue.go | 3 ++- templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 81ab13980a..7404d046fe 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -239,6 +239,14 @@ func NewFuncMap() []template.FuncMap { "MirrorFullAddress": mirror_service.AddressNoCredentials, "MirrorUserName": mirror_service.Username, "MirrorPassword": mirror_service.Password, + "contain": func(s []int64, id int64) bool { + for i := 0; i < len(s); i++ { + if s[i] == id { + return true + } + } + return false + }, }} } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 16a049c7aa..40e3b140ec 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -261,7 +261,8 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB } ctx.Data["IssueStats"] = issueStats - ctx.Data["SelectLabels"] = com.StrTo(selectLabels).MustInt64() + ctx.Data["SelLabelIDs"] = labelIDs + ctx.Data["SelectLabels"] = selectLabels ctx.Data["ViewType"] = viewType ctx.Data["SortType"] = sortType ctx.Data["MilestoneID"] = milestoneID diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 6af8311313..5572df671e 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -154,7 +154,7 @@ diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 889cd2c2f6..f5c6e17331 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -60,7 +60,7 @@ @@ -148,7 +148,7 @@