@@ -17,10 +17,6 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
1717 IsClosed : opts .IsClosed ,
1818 }
1919
20- if opts .ProjectID != 0 {
21- searchOpt .ProjectID = & opts .ProjectID
22- }
23-
2420 if len (opts .LabelIDs ) == 1 && opts .LabelIDs [0 ] == 0 {
2521 searchOpt .NoLabelOnly = true
2622 } else {
@@ -41,25 +37,27 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
4137 searchOpt .MilestoneIDs = opts .MilestoneIDs
4238 }
4339
44- if opts .AssigneeID > 0 {
45- searchOpt .AssigneeID = & opts .AssigneeID
46- }
47- if opts .PosterID > 0 {
48- searchOpt .PosterID = & opts .PosterID
49- }
50- if opts .MentionedID > 0 {
51- searchOpt .MentionID = & opts .MentionedID
52- }
53- if opts .ReviewedID > 0 {
54- searchOpt .ReviewedID = & opts .ReviewedID
55- }
56- if opts .ReviewRequestedID > 0 {
57- searchOpt .ReviewRequestedID = & opts .ReviewRequestedID
58- }
59- if opts .SubscriberID > 0 {
60- searchOpt .SubscriberID = & opts .SubscriberID
40+ // See the comment of issues_model.SearchOptions for the reason why we need to convert
41+ convertID := func (id int64 ) * int64 {
42+ if id > 0 {
43+ return & id
44+ }
45+ if id == db .NoConditionID {
46+ var zero int64
47+ return & zero
48+ }
49+ return nil
6150 }
6251
52+ searchOpt .ProjectID = convertID (opts .ProjectID )
53+ searchOpt .ProjectBoardID = convertID (opts .ProjectBoardID )
54+ searchOpt .PosterID = convertID (opts .PosterID )
55+ searchOpt .AssigneeID = convertID (opts .AssigneeID )
56+ searchOpt .MentionID = convertID (opts .MentionedID )
57+ searchOpt .ReviewedID = convertID (opts .ReviewedID )
58+ searchOpt .ReviewRequestedID = convertID (opts .ReviewRequestedID )
59+ searchOpt .SubscriberID = convertID (opts .SubscriberID )
60+
6361 if opts .UpdatedAfterUnix > 0 {
6462 searchOpt .UpdatedAfterUnix = & opts .UpdatedAfterUnix
6563 }
0 commit comments