Commit d260958e authored by Etienne Baqué's avatar Etienne Baqué

Merge branch '320900-follow-up-from-prevent-new-note-notifications-from-ghost-user' into 'master'

Clean up new note notification check

See merge request gitlab-org/gitlab!53706
parents 7a57eef4 3a975e1c
...@@ -542,7 +542,7 @@ class Note < ApplicationRecord ...@@ -542,7 +542,7 @@ class Note < ApplicationRecord
end end
def skip_notification? def skip_notification?
review.present? review.present? || author.ghost?
end end
private private
......
...@@ -13,7 +13,7 @@ class NewNoteWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -13,7 +13,7 @@ class NewNoteWorker # rubocop:disable Scalability/IdempotentWorker
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def perform(note_id, _params = {}) def perform(note_id, _params = {})
if note = Note.find_by(id: note_id) 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 Notes::PostProcessService.new(note).execute
else else
Gitlab::AppLogger.error("NewNoteWorker: couldn't find note with ID=#{note_id}, skipping job") 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