aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-06-17 18:23:15 +0800
committerGitHub <noreply@github.com>2024-06-17 10:23:15 +0000
commita9d1e4311e56855a6efc8defd3686f7f985617d0 (patch)
tree55a0e2ecee05f6b8a00509fe7eed38126bb0dd46
parented0fc0ec46466eb25e77cfefbf7f6d05f6f902b8 (diff)
downloadgitea-a9d1e4311e56855a6efc8defd3686f7f985617d0.tar.gz
gitea-a9d1e4311e56855a6efc8defd3686f7f985617d0.zip
Fix bug filtering issues which have no project (#31337) (#31367)
-rw-r--r--modules/indexer/issues/dboptions.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/indexer/issues/dboptions.go b/modules/indexer/issues/dboptions.go
index 8f94088742..c323e3588e 100644
--- a/modules/indexer/issues/dboptions.go
+++ b/modules/indexer/issues/dboptions.go
@@ -38,6 +38,12 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
searchOpt.MilestoneIDs = opts.MilestoneIDs
}
+ if opts.ProjectID > 0 {
+ searchOpt.ProjectID = optional.Some(opts.ProjectID)
+ } else if opts.ProjectID == -1 { // FIXME: this is inconsistent from other places
+ searchOpt.ProjectID = optional.Some[int64](0) // Those issues with no project(projectid==0)
+ }
+
// See the comment of issues_model.SearchOptions for the reason why we need to convert
convertID := func(id int64) optional.Option[int64] {
if id > 0 {
@@ -49,7 +55,6 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
return nil
}
- searchOpt.ProjectID = convertID(opts.ProjectID)
searchOpt.ProjectBoardID = convertID(opts.ProjectBoardID)
searchOpt.PosterID = convertID(opts.PosterID)
searchOpt.AssigneeID = convertID(opts.AssigneeID)