Fixes milestone/merge_request API endpoint to really scope the results

The MergeRequestsFinder uses the milestone_title instead of the
milestone_id
This commit is contained in:
Joren De Groof 2017-03-31 11:38:40 +02:00
parent 2faf955c24
commit d663b8de24
5 changed files with 9 additions and 3 deletions

View file

@ -9,7 +9,7 @@
# state: 'open' or 'closed' or 'all' # state: 'open' or 'closed' or 'all'
# group_id: integer # group_id: integer
# project_id: integer # project_id: integer
# milestone_id: integer # milestone_title: string
# assignee_id: integer # assignee_id: integer
# search: string # search: string
# label_name: string # label_name: string

View file

@ -9,7 +9,7 @@
# state: 'open' or 'closed' or 'all' # state: 'open' or 'closed' or 'all'
# group_id: integer # group_id: integer
# project_id: integer # project_id: integer
# milestone_id: integer # milestone_title: string
# assignee_id: integer # assignee_id: integer
# search: string # search: string
# label_name: string # label_name: string

View file

@ -0,0 +1,4 @@
---
title: Fixes milestone/merge_requests endpoint to actually scope the result
merge_request:
author: Joren De Groof

View file

@ -139,7 +139,7 @@ module API
finder_params = { finder_params = {
project_id: user_project.id, project_id: user_project.id,
milestone_id: milestone.id, milestone_title: milestone.title,
sort: 'position_asc' sort: 'position_asc'
} }

View file

@ -306,6 +306,8 @@ describe API::Milestones, api: true do
end end
it 'returns project merge_requests for a particular milestone' do 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) get api("/projects/#{project.id}/milestones/#{milestone.id}/merge_requests", user)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)