Commit 1c9ba0c5 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'fix-deployments-pagination' into 'master'

Add API pagination for deployed merge requests

See merge request gitlab-org/gitlab!25733
parents 9ea6f8ed 996b1ff1
---
title: Add API pagination for deployed merge requests
merge_request: 25733
author:
type: performance
......@@ -143,6 +143,7 @@ module API
success Entities::MergeRequestBasic
end
params do
use :pagination
requires :deployment_id, type: Integer, desc: 'The deployment ID'
use :merge_requests_base_params
end
......@@ -153,7 +154,7 @@ module API
mr_params = declared_params.merge(deployment_id: params[:deployment_id])
merge_requests = MergeRequestsFinder.new(current_user, mr_params).execute
present merge_requests, { with: Entities::MergeRequestBasic, current_user: current_user }
present paginate(merge_requests), { with: Entities::MergeRequestBasic, current_user: current_user }
end
end
end
......
......@@ -444,6 +444,7 @@ describe API::Deployments do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response.map { |d| d['id'] }).to contain_exactly(merge_request1.id, merge_request2.id)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment