Commit 3a975e1c authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Clean up new note notification check

Moves the check to note.skip_notification?
parent 02acc3f6
......@@ -542,7 +542,7 @@ class Note < ApplicationRecord
end
def skip_notification?
review.present?
review.present? || author.ghost?
end
private
......
......@@ -13,7 +13,7 @@ class NewNoteWorker # rubocop:disable Scalability/IdempotentWorker
# rubocop: disable CodeReuse/ActiveRecord
def perform(note_id, _params = {})
if note = Note.find_by(id: note_id)
NotificationService.new.new_note(note) unless note.skip_notification? || note.author.ghost?
NotificationService.new.new_note(note) unless note.skip_notification?
Notes::PostProcessService.new(note).execute
else
Gitlab::AppLogger.error("NewNoteWorker: couldn't find note with ID=#{note_id}, skipping job")
......
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