mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-16 15:57:22 +00:00
Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
@ -542,7 +542,7 @@ class Note < ApplicationRecord
|
||||
end
|
||||
|
||||
def skip_notification?
|
||||
review.present? || author.ghost?
|
||||
review.present? || author.blocked? || author.ghost?
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
title: Prevent blocked user from triggering notifications
|
||||
merge_request: 53788
|
||||
author:
|
||||
type: other
|
@ -39,7 +39,7 @@ module Gitlab
|
||||
options.evaluate(&block)
|
||||
|
||||
if disabled_by_feature(options)
|
||||
synchronized_cache_fill(name) { NullMetric.instance }
|
||||
synchronized_cache_fill(name) { ::Gitlab::Metrics::NullMetric.instance }
|
||||
else
|
||||
synchronized_cache_fill(name) { build_metric!(type, name, options) }
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ module Gitlab
|
||||
|
||||
# env - A Hash containing Rack environment details.
|
||||
def call(env)
|
||||
trans = WebTransaction.new(env)
|
||||
trans = Gitlab::Metrics::WebTransaction.new(env)
|
||||
|
||||
begin
|
||||
retval = trans.run { @app.call(env) }
|
||||
|
@ -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) }
|
||||
|
||||
|
Reference in New Issue
Block a user