1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-02 08:57:32 -04:00

Fix label filter between all and no (#26557)

Regression of https://github.com/go-gitea/gitea/pull/25886.
# Description 
For `labelIDs`:

9afcb0e046/routers/web/repo/issue.go (L171-L174)
 - `nil` mean no filter
 - `[0]` mean `no label` filter

When `selectLabels == "0"`, labelIDs should be `[0]` rather than `nil`
 # Before:
 


https://github.com/go-gitea/gitea/assets/50507092/3dac5075-6da0-4769-ba20-48a56f4063c0


#  After:


https://github.com/go-gitea/gitea/assets/50507092/ff79fd4c-b02e-4dfb-9309-ae7851f4dcdb

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
CaiCandong 2023-08-17 21:19:24 +08:00 committed by GitHub
parent c179ab4236
commit 940f997512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,7 +177,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
ctx.Data["AllLabels"] = true ctx.Data["AllLabels"] = true
} else if selectLabels == "0" { } else if selectLabels == "0" {
ctx.Data["NoLabel"] = true ctx.Data["NoLabel"] = true
} else if len(selectLabels) > 0 { }
if len(selectLabels) > 0 {
labelIDs, err = base.StringsToInt64s(strings.Split(selectLabels, ",")) labelIDs, err = base.StringsToInt64s(strings.Split(selectLabels, ","))
if err != nil { if err != nil {
ctx.ServerError("StringsToInt64s", err) ctx.ServerError("StringsToInt64s", err)