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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
caa6851b
Commit
caa6851b
authored
Nov 29, 2015
by
Anton Baklanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed duplicated issue note email notifications.
Fixes #2560
parent
4294d2cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
CHANGELOG
CHANGELOG
+1
-0
app/services/notification_service.rb
app/services/notification_service.rb
+1
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+6
-3
No files found.
CHANGELOG
View file @
caa6851b
...
...
@@ -23,6 +23,7 @@ v 8.2.2
- Prevent "413 Request entity too large" errors when pushing large files with LFS
- Fix invalid links within projects dashboard header
- Make current user the first user in assignee dropdown in issues detail page (Stan Hu)
- Fix: duplicate email notifications on issue comments
v 8.2.1
- Forcefully update builds that didn't want to update with state machine
...
...
app/services/notification_service.rb
View file @
caa6851b
...
...
@@ -145,6 +145,7 @@ class NotificationService
recipients
=
reject_unsubscribed_users
(
recipients
,
note
.
noteable
)
recipients
.
delete
(
note
.
author
)
recipients
=
recipients
.
uniq
# build notify method like 'note_commit_email'
notify_method
=
"note_
#{
note
.
noteable_type
.
underscore
}
_email"
.
to_sym
...
...
spec/services/notification_service_spec.rb
View file @
caa6851b
...
...
@@ -45,6 +45,7 @@ describe NotificationService do
project
.
team
<<
[
issue
.
author
,
:master
]
project
.
team
<<
[
issue
.
assignee
,
:master
]
project
.
team
<<
[
note
.
author
,
:master
]
create
(
:note_on_issue
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@subscribed_participant cc this guy'
)
end
describe
:new_note
do
...
...
@@ -60,6 +61,7 @@ describe NotificationService do
should_email
(
note
.
noteable
.
assignee
)
should_email
(
@u_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscribed_participant
)
should_not_email
(
note
.
author
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
...
...
@@ -381,18 +383,19 @@ describe NotificationService do
def
add_users_with_subscription
(
project
,
issuable
)
@subscriber
=
create
:user
@unsubscriber
=
create
:user
@subscribed_participant
=
create
(
:user
,
username:
'subscribed_participant'
,
notification_level:
Notification
::
N_PARTICIPATING
)
project
.
team
<<
[
@subscribed_participant
,
:master
]
project
.
team
<<
[
@subscriber
,
:master
]
project
.
team
<<
[
@unsubscriber
,
:master
]
issuable
.
subscriptions
.
create
(
user:
@subscriber
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@subscribed_participant
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@unsubscriber
,
subscribed:
false
)
end
def
sent_to_user?
(
user
)
ActionMailer
::
Base
.
deliveries
.
any?
do
|
message
|
message
.
to
.
include?
(
user
.
email
)
end
ActionMailer
::
Base
.
deliveries
.
map
(
&
:to
).
flatten
.
count
(
user
.
email
)
==
1
end
def
should_email
(
user
)
...
...
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