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
ea5da303
Commit
ea5da303
authored
Aug 26, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't notify users without access to the project when they are (accidentally) mentioned in a note.
parent
5b93c557
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
CHANGELOG
CHANGELOG
+1
-0
app/services/notification_service.rb
app/services/notification_service.rb
+8
-3
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+9
-2
No files found.
CHANGELOG
View file @
ea5da303
...
...
@@ -19,6 +19,7 @@ v 8.0.0 (unreleased)
- Move dashboard activity to separate page
- Improve performance of git blame
- Limit content width to 1200px for most of pages to improve readability on big screens
- Don't notify users without access to the project when they are (accidentally) mentioned in a note.
v 7.14.1
- Improve abuse reports management from admin area
...
...
app/services/notification_service.rb
View file @
ea5da303
...
...
@@ -107,12 +107,17 @@ class NotificationService
recipients
=
[]
mentioned_users
=
note
.
mentioned_users
mentioned_users
.
select!
do
|
user
|
user
.
can?
(
:read_project
,
note
.
project
)
end
# Add all users participating in the thread (author, assignee, comment authors)
participants
=
if
target
.
respond_to?
(
:participants
)
target
.
participants
(
note
.
author
)
else
note
.
mentioned_users
mentioned_users
end
recipients
=
recipients
.
concat
(
participants
)
...
...
@@ -120,8 +125,8 @@ class NotificationService
recipients
=
add_project_watchers
(
recipients
,
note
.
project
)
# Reject users with Mention notification level, except those mentioned in _this_ note.
recipients
=
reject_mention_users
(
recipients
-
note
.
mentioned_users
,
note
.
project
)
recipients
=
recipients
+
note
.
mentioned_users
recipients
=
reject_mention_users
(
recipients
-
mentioned_users
,
note
.
project
)
recipients
=
recipients
+
mentioned_users
recipients
=
reject_muted_users
(
recipients
,
note
.
project
)
...
...
spec/services/notification_service_spec.rb
View file @
ea5da303
...
...
@@ -31,13 +31,16 @@ describe NotificationService do
describe
'Notes'
do
context
'issue note'
do
let
(
:project
)
{
create
(
:empty_project
,
:p
ublic
)
}
let
(
:project
)
{
create
(
:empty_project
,
:p
rivate
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee:
create
(
:user
))
}
let
(
:mentioned_issue
)
{
create
(
:issue
,
assignee:
issue
.
assignee
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@mention referenced'
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@mention referenced
, @outsider also
'
)
}
before
do
build_team
(
note
.
project
)
project
.
team
<<
[
issue
.
author
,
:master
]
project
.
team
<<
[
issue
.
assignee
,
:master
]
project
.
team
<<
[
note
.
author
,
:master
]
end
describe
:new_note
do
...
...
@@ -53,6 +56,7 @@ describe NotificationService do
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@unsubscriber
.
id
)
should_not_email
(
@u_outsider_mentioned
)
notification
.
new_note
(
note
)
end
...
...
@@ -444,12 +448,15 @@ describe NotificationService do
@u_mentioned
=
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_MENTION
)
@u_committer
=
create
(
:user
,
username:
'committer'
)
@u_not_mentioned
=
create
(
:user
,
username:
'regular'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_outsider_mentioned
=
create
(
:user
,
username:
'outsider'
)
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
project
.
team
<<
[
@u_participant_mentioned
,
:master
]
project
.
team
<<
[
@u_disabled
,
:master
]
project
.
team
<<
[
@u_mentioned
,
:master
]
project
.
team
<<
[
@u_committer
,
:master
]
project
.
team
<<
[
@u_not_mentioned
,
:master
]
end
def
add_users_with_subscription
(
project
,
issuable
)
...
...
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