Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7293a92

Browse files
committedDec 28, 2019
Fix repository issues pagination bug when there are more than one label filter
1 parent 55cd33e commit 7293a92

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed
 

Diff for: ‎modules/templates/helper.go

+8
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ func NewFuncMap() []template.FuncMap {
269269
return ""
270270
}
271271
},
272+
"contain": func(s []int64, id int64) bool {
273+
for i := 0; i < len(s); i++ {
274+
if s[i] == id {
275+
return true
276+
}
277+
}
278+
return false
279+
},
272280
}}
273281
}
274282

Diff for: ‎routers/repo/issue.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
264264
}
265265

266266
ctx.Data["IssueStats"] = issueStats
267-
ctx.Data["SelectLabels"] = com.StrTo(selectLabels).MustInt64()
267+
ctx.Data["SelLabelIDs"] = labelIDs
268+
ctx.Data["SelectLabels"] = selectLabels
268269
ctx.Data["ViewType"] = viewType
269270
ctx.Data["SortType"] = sortType
270271
ctx.Data["MilestoneID"] = milestoneID

Diff for: ‎templates/repo/issue/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<div class="menu">
156156
{{range .Labels}}
157157
<div class="item issue-action has-emoji" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
158-
<span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
158+
<span class="octicon {{if contain $.SelLabelIDs .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
159159
</div>
160160
{{end}}
161161
</div>

Diff for: ‎templates/repo/issue/milestone_issues.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<span class="info">{{.i18n.Tr "repo.issues.filter_label_exclude" | Safe}}</span>
6262
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
6363
{{range .Labels}}
64-
<a class="item has-emoji label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}" data-label-id="{{.ID}}"><span class="octicon {{if .IsExcluded}}octicon-circle-slash{{else if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
64+
<a class="item has-emoji label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}" data-label-id="{{.ID}}"><span class="octicon {{if .IsExcluded}}octicon-circle-slash{{else if contain $.SelLabelIDs .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
6565
{{end}}
6666
</div>
6767
</div>
@@ -149,7 +149,7 @@
149149
<div class="menu">
150150
{{range .Labels}}
151151
<div class="item issue-action has-emoji" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
152-
<span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
152+
<span class="octicon {{if contain $.SelLabelIDs .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
153153
</div>
154154
{{end}}
155155
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.