Skip to content

Commit a9d1e43

Browse files
authored
Fix bug filtering issues which have no project (#31337) (#31367)
1 parent ed0fc0e commit a9d1e43

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/indexer/issues/dboptions.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
3838
searchOpt.MilestoneIDs = opts.MilestoneIDs
3939
}
4040

41+
if opts.ProjectID > 0 {
42+
searchOpt.ProjectID = optional.Some(opts.ProjectID)
43+
} else if opts.ProjectID == -1 { // FIXME: this is inconsistent from other places
44+
searchOpt.ProjectID = optional.Some[int64](0) // Those issues with no project(projectid==0)
45+
}
46+
4147
// See the comment of issues_model.SearchOptions for the reason why we need to convert
4248
convertID := func(id int64) optional.Option[int64] {
4349
if id > 0 {
@@ -49,7 +55,6 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
4955
return nil
5056
}
5157

52-
searchOpt.ProjectID = convertID(opts.ProjectID)
5358
searchOpt.ProjectBoardID = convertID(opts.ProjectBoardID)
5459
searchOpt.PosterID = convertID(opts.PosterID)
5560
searchOpt.AssigneeID = convertID(opts.AssigneeID)

0 commit comments

Comments
 (0)