From 21c8603832130482a03a4381503bfe36a476aaef Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 28 Dec 2019 22:43:46 +0800 Subject: [PATCH 1/2] Fix repository issues pagination bug when there are more than one label filter (#9512) --- modules/templates/helper.go | 8 ++++++++ routers/repo/issue.go | 3 ++- templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 6 +++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 81ab13980a485..7404d046fefde 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 16a049c7aa6df..40e3b140ec211 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 6af8311313267..5572df671e260 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 889cd2c2f6715..56c8e17914b35 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -60,7 +60,11 @@ @@ -148,7 +152,7 @@ From 26bed7fb24b3d44131e6c04ca889a75c982b0422 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 28 Dec 2019 23:50:26 +0800 Subject: [PATCH 2/2] fix merge --- templates/repo/issue/milestone_issues.tmpl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 56c8e17914b35..f5c6e17331014 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -60,11 +60,7 @@