Commit 1e075ea9 authored by Robert May's avatar Robert May

Add cache_action to repository compare

parent bf7b31d8
---
name: api_caching_rate_limit_repository_compare
introduced_by_url:
rollout_issue_url:
milestone: '14.0'
type: development
group: group::source code
default_enabled: false
......@@ -120,6 +120,9 @@ module API
optional :straight, type: Boolean, desc: 'Comparison method, `true` for direct comparison between `from` and `to` (`from`..`to`), `false` to compare using merge base (`from`...`to`)', default: false
end
get ':id/repository/compare' do
ff_enabled = Feature.enabled?(:api_caching_rate_limit_repository_compare, user_project, default_enabled: :yaml)
cache_action_if(ff_enabled, [user_project, :repository_compare, current_user, declared_params], expires_in: 30.seconds) do
if params[:from_project_id].present?
target_project = MergeRequestTargetProjectFinder
.new(current_user: current_user, source_project: user_project, project_feature: :repository)
......@@ -140,6 +143,7 @@ module API
not_found!("Ref")
end
end
end
desc 'Get repository contributors' do
success Entities::Contributor
......
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