Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9c71509c
Commit
9c71509c
authored
Feb 10, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
acddb55b
54c5a90e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
app/models/note.rb
app/models/note.rb
+1
-1
changelogs/unreleased/prevent_blocked_user_notification.yml
changelogs/unreleased/prevent_blocked_user_notification.yml
+5
-0
lib/gitlab/metrics/rack_middleware.rb
lib/gitlab/metrics/rack_middleware.rb
+1
-1
spec/workers/new_note_worker_spec.rb
spec/workers/new_note_worker_spec.rb
+10
-0
No files found.
app/models/note.rb
View file @
9c71509c
...
@@ -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
...
...
changelogs/unreleased/prevent_blocked_user_notification.yml
0 → 100644
View file @
9c71509c
---
title
:
Prevent blocked user from triggering notifications
merge_request
:
53788
author
:
type
:
other
lib/gitlab/metrics/rack_middleware.rb
View file @
9c71509c
...
@@ -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
)
}
...
...
spec/workers/new_note_worker_spec.rb
View file @
9c71509c
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment