Commit d6c6bde9 authored by Sean McGivern's avatar Sean McGivern

Merge branch '210301-dont-recalculate-approval-metric-on-unapprove' into 'master'

Don't recalculate approval metrics on approval remove

Closes #210301

See merge request gitlab-org/gitlab!27071
parents 0a06be7d 560ae1db
...@@ -14,7 +14,6 @@ module MergeRequests ...@@ -14,7 +14,6 @@ module MergeRequests
if approval.destroy_all # rubocop: disable DestroyAll if approval.destroy_all # rubocop: disable DestroyAll
merge_request.reset_approval_cache! merge_request.reset_approval_cache!
create_note(merge_request) create_note(merge_request)
recalculate_approvals_metrics(merge_request)
if currently_approved if currently_approved
notification_service.async.unapprove_mr(merge_request, current_user) notification_service.async.unapprove_mr(merge_request, current_user)
...@@ -31,11 +30,5 @@ module MergeRequests ...@@ -31,11 +30,5 @@ module MergeRequests
def create_note(merge_request) def create_note(merge_request)
SystemNoteService.unapprove_mr(merge_request, current_user) SystemNoteService.unapprove_mr(merge_request, current_user)
end end
def recalculate_approvals_metrics(merge_request)
return unless merge_request.project.feature_available?(:code_review_analytics)
Analytics::RefreshApprovalsData.new(merge_request).execute_async(force: true)
end
end end
end end
---
title: Remove approval metric recalculation when approval was removed
merge_request: 27071
author:
type: changed
...@@ -50,33 +50,6 @@ describe MergeRequests::RemoveApprovalService do ...@@ -50,33 +50,6 @@ describe MergeRequests::RemoveApprovalService do
execute! execute!
end end
context 'approvals metrics calculation' do
context 'when code_review_analytics project feature is available' do
before do
stub_licensed_features(code_review_analytics: true)
end
it 'schedules RefreshApprovalsData' do
expect(Analytics::CodeReviewMetricsWorker)
.to receive(:perform_async).with('Analytics::RefreshApprovalsData', merge_request.id, force: true)
service.execute(merge_request)
end
end
context 'when code_review_analytics is not available' do
before do
stub_licensed_features(code_review_analytics: false)
end
it 'does not schedule for RefreshApprovalsData' do
expect(Analytics::CodeReviewMetricsWorker).not_to receive(:perform_async)
service.execute(merge_request)
end
end
end
end end
context 'with an approved merge request' do context 'with an approved merge request' do
......
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