Merge branch 'add-pagination-commit-diffs' into 'master'
Add missing pagination on the commit diff endpoint Closes #43370 See merge request gitlab-org/gitlab-ce!17203
This commit is contained in:
commit
94ac29f66d
3 changed files with 10 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add missing pagination on the commit diff endpoint
|
||||
merge_request: 17203
|
||||
author: Maxime Roussin-Bélanger
|
||||
type: fixed
|
|
@ -97,13 +97,16 @@ module API
|
|||
end
|
||||
params do
|
||||
requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag'
|
||||
use :pagination
|
||||
end
|
||||
get ':id/repository/commits/:sha/diff', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do
|
||||
commit = user_project.commit(params[:sha])
|
||||
|
||||
not_found! 'Commit' unless commit
|
||||
|
||||
present commit.raw_diffs.to_a, with: Entities::Diff
|
||||
raw_diffs = ::Kaminari.paginate_array(commit.raw_diffs.to_a)
|
||||
|
||||
present paginate(raw_diffs), with: Entities::Diff
|
||||
end
|
||||
|
||||
desc "Get a commit's comments" do
|
||||
|
|
|
@ -698,6 +698,7 @@ describe API::Commits do
|
|||
get api(route, current_user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response.size).to be >= 1
|
||||
expect(json_response.first.keys).to include 'diff'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue