Commit 673ecd88 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'remove-batch-review-notification-feature-flag' into 'master'

Removes batch_review_notification feature flag

See merge request gitlab-org/gitlab-ee!8933
parents 949ebbf3 eb5c2807
......@@ -27,21 +27,15 @@ module DraftNotes
def publish_draft_notes
return if draft_notes.empty?
if Feature.enabled?(:batch_review_notification, project)
review = Review.create!(author: current_user, merge_request: merge_request, project: project)
review = Review.create!(author: current_user, merge_request: merge_request, project: project)
draft_notes.map do |draft_note|
draft_note.review = review
create_note_from_draft(draft_note)
end
notification_service.async.new_review(review)
else
draft_notes.each(&method(:create_note_from_draft))
draft_notes.map do |draft_note|
draft_note.review = review
create_note_from_draft(draft_note)
end
draft_notes.delete_all
notification_service.async.new_review(review)
MergeRequests::ResolvedDiscussionNotificationService.new(project, current_user).execute(merge_request)
end
......
......@@ -65,28 +65,12 @@ describe DraftNotes::PublishService do
expect(DraftNote.count).to eq(0)
end
context 'when batch_review_notification feature is enabled' do
it 'sends batch notification' do
expect_next_instance_of(NotificationService) do |notification_service|
expect(notification_service).to receive_message_chain(:async, :new_review).with(kind_of(Review))
end
publish
it 'sends batch notification' do
expect_next_instance_of(NotificationService) do |notification_service|
expect(notification_service).to receive_message_chain(:async, :new_review).with(kind_of(Review))
end
end
context 'when batch_review_notification feature is disabled' do
it 'send a notification for each note' do
stub_feature_flags(batch_review_notification: false)
2.times do
expect_next_instance_of(NotificationService) do |notification_service|
expect(notification_service).to receive(:new_note).with(kind_of(Note))
end
end
publish
end
publish
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