forked from NYANDEV/forgejo
Add the ability to use multiple labels as filters(#5786)
This commit is contained in:
parent
6a949af8ca
commit
075649572d
9 changed files with 74 additions and 24 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
|
@ -256,7 +257,16 @@ func Issues(ctx *context.Context) {
|
|||
|
||||
opts.Page = page
|
||||
opts.PageSize = setting.UI.IssuePagingNum
|
||||
opts.Labels = ctx.Query("labels")
|
||||
var labelIDs []int64
|
||||
selectLabels := ctx.Query("labels")
|
||||
if len(selectLabels) > 0 && selectLabels != "0" {
|
||||
labelIDs, err = base.StringsToInt64s(strings.Split(selectLabels, ","))
|
||||
if err != nil {
|
||||
ctx.ServerError("StringsToInt64s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
opts.LabelIDs = labelIDs
|
||||
|
||||
issues, err := models.Issues(opts)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue