Commit 9c71509c authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents acddb55b 54c5a90e
...@@ -542,7 +542,7 @@ class Note < ApplicationRecord ...@@ -542,7 +542,7 @@ class Note < ApplicationRecord
end end
def skip_notification? def skip_notification?
review.present? || author.ghost? review.present? || author.blocked? || author.ghost?
end end
private private
......
---
title: Prevent blocked user from triggering notifications
merge_request: 53788
author:
type: other
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
# env - A Hash containing Rack environment details. # env - A Hash containing Rack environment details.
def call(env) def call(env)
trans = WebTransaction.new(env) trans = Gitlab::Metrics::WebTransaction.new(env)
begin begin
retval = trans.run { @app.call(env) } retval = trans.run { @app.call(env) }
......
...@@ -66,6 +66,16 @@ RSpec.describe NewNoteWorker do ...@@ -66,6 +66,16 @@ RSpec.describe NewNoteWorker do
end end
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 context 'when Note author has been deleted' do
let_it_be(:note) { create(:note, author: User.ghost) } 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