Skip to content

Commit 7fb19f3

Browse files
committed
Fix bug filtering issues which have no project (go-gitea#31337)
Fix go-gitea#31327 This is a quick patch to fix the bug. Some parameters are using 0, some are using -1. I think it needs a refactor to keep consistent. But that will be another PR.
1 parent cdd057c commit 7fb19f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/indexer/issues/dboptions.go

Lines changed: 6 additions & 1 deletion
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)