Commit bd3a20b8 authored by charlie ablett's avatar charlie ablett

Merge branch 'prevent_blocked_user_notification' into 'master'

Prevent blocked user from triggering notifications

See merge request gitlab-org/gitlab!53788
parents 3677c63c 9604b489
......@@ -542,7 +542,7 @@ class Note < ApplicationRecord
end
def skip_notification?
review.present? || author.ghost?
review.present? || author.blocked? || author.ghost?
end
private
......
---
title: Prevent blocked user from triggering notifications
merge_request: 53788
author:
type: other
......@@ -66,6 +66,16 @@ RSpec.describe NewNoteWorker do
end
end
context 'when Note author has been blocked' do
let_it_be(:note) { create(:note, author: create(:user, :blocked)) }
it "does not call NotificationService" do
expect(NotificationService).not_to receive(:new)
described_class.new.perform(note.id)
end
end
context 'when Note author has been deleted' do
let_it_be(:note) { create(:note, author: User.ghost) }
......
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