summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/finders/issues_finder.rb2
-rw-r--r--app/finders/merge_requests_finder.rb2
-rw-r--r--changelogs/unreleased/bug-api_milestone_merge_requests_scope.yml4
-rw-r--r--lib/api/milestones.rb2
-rw-r--r--spec/requests/api/milestones_spec.rb2
5 files changed, 9 insertions, 3 deletions
diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb
index 08713272947..76715e5970d 100644
--- a/app/finders/issues_finder.rb
+++ b/app/finders/issues_finder.rb
@@ -9,7 +9,7 @@
# state: 'open' or 'closed' or 'all'
# group_id: integer
# project_id: integer
-# milestone_id: integer
+# milestone_title: string
# assignee_id: integer
# search: string
# label_name: string
diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb
index 1eec45d9cb5..42f0ebd774c 100644
--- a/app/finders/merge_requests_finder.rb
+++ b/app/finders/merge_requests_finder.rb
@@ -9,7 +9,7 @@
# state: 'open' or 'closed' or 'all'
# group_id: integer
# project_id: integer
-# milestone_id: integer
+# milestone_title: string
# assignee_id: integer
# search: string
# label_name: string
diff --git a/changelogs/unreleased/bug-api_milestone_merge_requests_scope.yml b/changelogs/unreleased/bug-api_milestone_merge_requests_scope.yml
new file mode 100644
index 00000000000..a1e1c29165e
--- /dev/null
+++ b/changelogs/unreleased/bug-api_milestone_merge_requests_scope.yml
@@ -0,0 +1,4 @@
+---
+title: Fixes milestone/merge_requests endpoint to actually scope the result
+merge_request:
+author: Joren De Groof
diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb
index e7ab82f08db..a3ea619a2fb 100644
--- a/lib/api/milestones.rb
+++ b/lib/api/milestones.rb
@@ -139,7 +139,7 @@ module API
finder_params = {
project_id: user_project.id,
- milestone_id: milestone.id,
+ milestone_title: milestone.title,
sort: 'position_asc'
}
diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb
index 7fb728fed6f..598968aff70 100644
--- a/spec/requests/api/milestones_spec.rb
+++ b/spec/requests/api/milestones_spec.rb
@@ -306,6 +306,8 @@ describe API::Milestones, api: true do
end
it 'returns project merge_requests for a particular milestone' do
+ # eager-load another_merge_request
+ another_merge_request
get api("/projects/#{project.id}/milestones/#{milestone.id}/merge_requests", user)
expect(response).to have_http_status(200)