Commit cf4763b8 authored by Max Woolf's avatar Max Woolf

Merge branch...

Merge branch '321935-reduce-n-1-queries-from-projects-mergerequestscontroller-index-action-related-to-protected' into 'master'

Reduce N+1 queries from Projects::MergeRequestsController#index action related to protected branches and code owners

See merge request gitlab-org/gitlab!56775
parents 2ba0f6b5 0459ed26
...@@ -16,6 +16,7 @@ module EE ...@@ -16,6 +16,7 @@ module EE
def branch_requires_code_owner_approval?(project, branch_name) def branch_requires_code_owner_approval?(project, branch_name)
return false unless project.code_owner_approval_required_available? return false unless project.code_owner_approval_required_available?
::Gitlab::SafeRequestStore["project-#{project.id}-branch-#{branch_name}".to_sym] ||=
project.protected_branches.requiring_code_owner_approval.matching(branch_name).any? project.protected_branches.requiring_code_owner_approval.matching(branch_name).any?
end end
end 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