@@ -42,6 +42,10 @@ func SearchIssues(ctx *context.APIContext) {
4242 // in: query
4343 // description: comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
4444 // type: string
45+ // - name: milestones
46+ // in: query
47+ // description: comma separated list of milestone names. Fetch only issues that have any of this milestones. Non existent are discarded
48+ // type: string
4549 // - name: q
4650 // in: query
4751 // description: search string
@@ -164,6 +168,12 @@ func SearchIssues(ctx *context.APIContext) {
164168 includedLabelNames = strings .Split (labels , "," )
165169 }
166170
171+ milestones := strings .TrimSpace (ctx .Query ("milestones" ))
172+ var includedMilestones []string
173+ if len (milestones ) > 0 {
174+ includedMilestones = strings .Split (milestones , "," )
175+ }
176+
167177 // this api is also used in UI,
168178 // so the default limit is set to fit UI needs
169179 limit := ctx .QueryInt ("limit" )
@@ -175,7 +185,7 @@ func SearchIssues(ctx *context.APIContext) {
175185
176186 // Only fetch the issues if we either don't have a keyword or the search returned issues
177187 // This would otherwise return all issues if no issues were found by the search.
178- if len (keyword ) == 0 || len (issueIDs ) > 0 || len (includedLabelNames ) > 0 {
188+ if len (keyword ) == 0 || len (issueIDs ) > 0 || len (includedLabelNames ) > 0 || len ( includedMilestones ) > 0 {
179189 issuesOpt := & models.IssuesOptions {
180190 ListOptions : models.ListOptions {
181191 Page : ctx .QueryInt ("page" ),
@@ -185,6 +195,7 @@ func SearchIssues(ctx *context.APIContext) {
185195 IsClosed : isClosed ,
186196 IssueIDs : issueIDs ,
187197 IncludedLabelNames : includedLabelNames ,
198+ IncludeMilestones : includedMilestones ,
188199 SortType : "priorityrepo" ,
189200 PriorityRepoID : ctx .QueryInt64 ("priority_repo_id" ),
190201 IsPull : isPull ,
0 commit comments