Skip to content

Commit 21c8603

Browse files
committed
Fix repository issues pagination bug when there are more than one label filter (go-gitea#9512)
1 parent 9409ac9 commit 21c8603

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

modules/templates/helper.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ func NewFuncMap() []template.FuncMap {
239239
"MirrorFullAddress": mirror_service.AddressNoCredentials,
240240
"MirrorUserName": mirror_service.Username,
241241
"MirrorPassword": mirror_service.Password,
242+
"contain": func(s []int64, id int64) bool {
243+
for i := 0; i < len(s); i++ {
244+
if s[i] == id {
245+
return true
246+
}
247+
}
248+
return false
249+
},
242250
}}
243251
}
244252

routers/repo/issue.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
261261
}
262262

263263
ctx.Data["IssueStats"] = issueStats
264-
ctx.Data["SelectLabels"] = com.StrTo(selectLabels).MustInt64()
264+
ctx.Data["SelLabelIDs"] = labelIDs
265+
ctx.Data["SelectLabels"] = selectLabels
265266
ctx.Data["ViewType"] = viewType
266267
ctx.Data["SortType"] = sortType
267268
ctx.Data["MilestoneID"] = milestoneID

templates/repo/issue/list.tmpl

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

templates/repo/issue/milestone_issues.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@
6060
<div class="menu">
6161
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
6262
{{range .Labels}}
63+
<<<<<<< HEAD
6364
<a class="item has-emoji" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
65+
=======
66+
<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>
67+
>>>>>>> ed67bbe44... Fix repository issues pagination bug when there are more than one label filter (#9512)
6468
{{end}}
6569
</div>
6670
</div>
@@ -148,7 +152,7 @@
148152
<div class="menu">
149153
{{range .Labels}}
150154
<div class="item issue-action has-emoji" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
151-
<span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
155+
<span class="octicon {{if contain $.SelLabelIDs .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
152156
</div>
153157
{{end}}
154158
</div>

0 commit comments

Comments
 (0)