Commit eb5c2807 authored by Tiago Botelho's avatar Tiago Botelho

Removes batch_review_notification feature flag

This feature flag was being used as a gatekeeper
for the one notification for every batch review
feature.

We no longer require the feature flag since the
code is working as expected
parent 3bb830f2
...@@ -27,21 +27,15 @@ module DraftNotes ...@@ -27,21 +27,15 @@ module DraftNotes
def publish_draft_notes def publish_draft_notes
return if draft_notes.empty? 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_notes.map do |draft_note|
draft_note.review = review draft_note.review = review
create_note_from_draft(draft_note) create_note_from_draft(draft_note)
end
notification_service.async.new_review(review)
else
draft_notes.each(&method(:create_note_from_draft))
end end
draft_notes.delete_all draft_notes.delete_all
notification_service.async.new_review(review)
MergeRequests::ResolvedDiscussionNotificationService.new(project, current_user).execute(merge_request) MergeRequests::ResolvedDiscussionNotificationService.new(project, current_user).execute(merge_request)
end end
......
...@@ -65,28 +65,12 @@ describe DraftNotes::PublishService do ...@@ -65,28 +65,12 @@ describe DraftNotes::PublishService do
expect(DraftNote.count).to eq(0) expect(DraftNote.count).to eq(0)
end end
context 'when batch_review_notification feature is enabled' do it 'sends batch notification' do
it 'sends batch notification' do expect_next_instance_of(NotificationService) do |notification_service|
expect_next_instance_of(NotificationService) do |notification_service| expect(notification_service).to receive_message_chain(:async, :new_review).with(kind_of(Review))
expect(notification_service).to receive_message_chain(:async, :new_review).with(kind_of(Review))
end
publish
end 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 publish
expect_next_instance_of(NotificationService) do |notification_service|
expect(notification_service).to receive(:new_note).with(kind_of(Note))
end
end
publish
end
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