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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
ddb23d3b
Commit
ddb23d3b
authored
Mar 30, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send issue due emails to all participants
parent
f4c8517f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
25 deletions
+34
-25
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+2
-2
app/services/notification_service.rb
app/services/notification_service.rb
+1
-1
spec/services/notification_recipient_service_spec.rb
spec/services/notification_recipient_service_spec.rb
+0
-22
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+31
-0
No files found.
app/services/notification_recipient_service.rb
View file @
ddb23d3b
...
...
@@ -230,7 +230,7 @@ module NotificationRecipientService
add_subscribed_users
if
[
:new_issue
,
:new_merge_request
,
:due_date_issue
].
include?
(
custom_action
)
if
[
:new_issue
,
:new_merge_request
].
include?
(
custom_action
)
# These will all be participants as well, but adding with the :mention
# type ensures that users with the mention notification level will
# receive them, too.
...
...
@@ -238,7 +238,7 @@ module NotificationRecipientService
# Add the assigned users, if any
assignees
=
case
custom_action
when
:new_issue
,
:due_date_issue
when
:new_issue
target
.
assignees
else
target
.
assignee
...
...
app/services/notification_service.rb
View file @
ddb23d3b
...
...
@@ -363,7 +363,7 @@ class NotificationService
end
end
def
issue_due
_email
(
issue
)
def
issue_due
(
issue
)
recipients
=
NotificationRecipientService
.
build_recipients
(
issue
,
issue
.
author
,
...
...
spec/services/notification_recipient_service_spec.rb
deleted
100644 → 0
View file @
f4c8517f
require
'spec_helper'
describe
NotificationRecipientService
do
describe
'build_recipients'
do
it
'due_date'
do
# These folks are being filtered out because they can't receive notifications
# notification_recipient.rb#85
user
=
create
(
:user
)
assignee
=
create
(
:user
)
issue
=
create
(
:issue
,
:opened
,
due_date:
Date
.
today
,
author:
user
,
assignees:
[
assignee
])
recipients
=
described_class
.
build_recipients
(
issue
,
issue
.
author
,
action:
"due_date"
,
skip_current_user:
false
)
expect
(
recipients
).
to
match_array
([
user
,
assignee
])
end
end
end
spec/services/notification_service_spec.rb
View file @
ddb23d3b
...
...
@@ -933,6 +933,37 @@ describe NotificationService, :mailer do
let
(
:notification_trigger
)
{
notification
.
issue_moved
(
issue
,
new_issue
,
@u_disabled
)
}
end
end
describe
'#issue_due'
do
it
'sends email to issue notification recipients'
do
notification
.
issue_due
(
issue
)
should_email
(
issue
.
assignees
.
first
)
should_email
(
issue
.
author
)
should_email
(
@u_watcher
)
should_email
(
@u_guest_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_lazy_participant
)
end
it
'sends the email from the author'
do
notification
.
issue_due
(
issue
)
email
=
find_email_for
(
@subscriber
)
expect
(
email
.
header
[
:from
].
display_names
).
to
eq
([
issue
.
author
.
name
])
end
it_behaves_like
'participating notifications'
do
let
(
:participant
)
{
create
(
:user
,
username:
'user-participant'
)
}
let
(
:issuable
)
{
issue
}
let
(
:notification_trigger
)
{
notification
.
issue_due
(
issue
)
}
end
end
end
describe
'Merge Requests'
do
...
...
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