@@ -17,10 +17,6 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
17
17
IsClosed : opts .IsClosed ,
18
18
}
19
19
20
- if opts .ProjectID != 0 {
21
- searchOpt .ProjectID = & opts .ProjectID
22
- }
23
-
24
20
if len (opts .LabelIDs ) == 1 && opts .LabelIDs [0 ] == 0 {
25
21
searchOpt .NoLabelOnly = true
26
22
} else {
@@ -41,25 +37,27 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
41
37
searchOpt .MilestoneIDs = opts .MilestoneIDs
42
38
}
43
39
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
61
50
}
62
51
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
+
63
61
if opts .UpdatedAfterUnix > 0 {
64
62
searchOpt .UpdatedAfterUnix = & opts .UpdatedAfterUnix
65
63
}
0 commit comments