Commit 620d73bb authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch...

Merge branch '33998-merge-requests-in-busy-repositories-can-create-race-conditions-and-allow-codeowners-checks-to' into 'master'

Update approvers before resetting approvals on MRs

Closes #33998

See merge request gitlab-org/gitlab!21140
parents bfad9291 fe5b93bc
......@@ -9,9 +9,10 @@ module EE
override :refresh_merge_requests!
def refresh_merge_requests!
update_approvers do
super && reset_approvals_for_merge_requests(push.ref, push.newrev)
end
update_approvers
reset_approvals_for_merge_requests(push.ref, push.newrev)
super
end
# Note: Closed merge requests also need approvals reset.
......@@ -38,14 +39,10 @@ module EE
end
def update_approvers
results = yield
merge_requests_for_source_branch.each do |merge_request|
::MergeRequests::SyncCodeOwnerApprovalRules.new(merge_request).execute if project.feature_available?(:code_owners)
::MergeRequests::SyncReportApproverApprovalRules.new(merge_request).execute if project.feature_available?(:report_approver_rules)
end
results
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