diff options
author | Robert Speicher <robert@gitlab.com> | 2018-02-21 16:51:10 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-02-21 16:51:10 +0000 |
commit | 94ac29f66d78e949b50e353c8ba4827bd33084ce (patch) | |
tree | 751730574b0a88822d555970f9a2db1fb684f2cc /lib/api | |
parent | 3487441b9a7058e143814a4fd64b4125a4fcc8a8 (diff) | |
parent | 0dafea8685f0376d4c474f7670a97d0b8e449767 (diff) | |
download | gitlab-ce-94ac29f66d78e949b50e353c8ba4827bd33084ce.tar.gz |
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
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/commits.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index d83c43ee49b..3d6e78d2d80 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -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 |