Commit 23aca014 authored by James Fargher's avatar James Fargher

Merge branch '210500-missing-merge-conflicts-email-notification' into 'master'

Fix missing unmergeable email notification for async mergeability check

See merge request gitlab-org/gitlab!27870
parents 3066bdd6 b7740592
......@@ -189,7 +189,7 @@ class MergeRequest < ApplicationRecord
end
# rubocop: disable CodeReuse/ServiceClass
after_transition unchecked: :cannot_be_merged do |merge_request, transition|
after_transition [:unchecked, :checking] => :cannot_be_merged do |merge_request, transition|
if merge_request.notify_conflict?
NotificationService.new.merge_request_unmergeable(merge_request)
TodoService.new.merge_request_became_unmergeable(merge_request)
......
......@@ -3223,6 +3223,14 @@ describe MergeRequest do
subject.mark_as_unmergeable
end
it 'notifies conflict, with enabled async mergability check' do
expect(notification_service).to receive(:merge_request_unmergeable).with(subject).once
expect(todo_service).to receive(:merge_request_became_unmergeable).with(subject).once
subject.mark_as_checking
subject.mark_as_unmergeable
end
it 'does not notify whenever merge request is newly unmergeable due to other reasons' do
allow(subject.project.repository).to receive(:can_be_merged?).and_return(true)
......
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