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
5f39f9b3
Commit
5f39f9b3
authored
Feb 06, 2018
by
Stuart Nelson
Committed by
Sean McGivern
Mar 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send email to recipients
parent
bebced8f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
4 deletions
+50
-4
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+6
-0
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+8
-2
app/services/notification_service.rb
app/services/notification_service.rb
+13
-0
app/views/notify/issue_due_email.html.haml
app/views/notify/issue_due_email.html.haml
+14
-0
app/views/notify/issue_due_email.text.erb
app/views/notify/issue_due_email.text.erb
+8
-0
app/workers/issue_due_worker.rb
app/workers/issue_due_worker.rb
+1
-2
No files found.
app/mailers/emails/issues.rb
View file @
5f39f9b3
...
@@ -6,6 +6,12 @@ module Emails
...
@@ -6,6 +6,12 @@ module Emails
mail_new_thread
(
@issue
,
issue_thread_options
(
@issue
.
author_id
,
recipient_id
,
reason
))
mail_new_thread
(
@issue
,
issue_thread_options
(
@issue
.
author_id
,
recipient_id
,
reason
))
end
end
def
issue_due_email
(
recipient_id
,
issue_id
,
reason
=
nil
)
setup_issue_mail
(
issue_id
,
recipient_id
)
mail_new_thread
(
@issue
,
issue_thread_options
(
@issue
.
author_id
,
recipient_id
,
reason
))
end
def
new_mention_in_issue_email
(
recipient_id
,
issue_id
,
updated_by_user_id
,
reason
=
nil
)
def
new_mention_in_issue_email
(
recipient_id
,
issue_id
,
updated_by_user_id
,
reason
=
nil
)
setup_issue_mail
(
issue_id
,
recipient_id
)
setup_issue_mail
(
issue_id
,
recipient_id
)
mail_answer_thread
(
@issue
,
issue_thread_options
(
updated_by_user_id
,
recipient_id
,
reason
))
mail_answer_thread
(
@issue
,
issue_thread_options
(
updated_by_user_id
,
recipient_id
,
reason
))
...
...
app/services/notification_recipient_service.rb
View file @
5f39f9b3
...
@@ -230,14 +230,20 @@ module NotificationRecipientService
...
@@ -230,14 +230,20 @@ module NotificationRecipientService
add_subscribed_users
add_subscribed_users
if
[
:new_issue
,
:new_merge_request
].
include?
(
custom_action
)
if
[
:new_issue
,
:new_merge_request
,
:due_date_issue
].
include?
(
custom_action
)
# These will all be participants as well, but adding with the :mention
# These will all be participants as well, but adding with the :mention
# type ensures that users with the mention notification level will
# type ensures that users with the mention notification level will
# receive them, too.
# receive them, too.
add_mentions
(
current_user
,
target:
target
)
add_mentions
(
current_user
,
target:
target
)
# Add the assigned users, if any
# Add the assigned users, if any
assignees
=
custom_action
==
:new_issue
?
target
.
assignees
:
target
.
assignee
assignees
=
case
custom_action
when
:new_issue
,
:due_date_issue
target
.
assignees
else
target
.
assignee
end
# We use the `:participating` notification level in order to match existing legacy behavior as captured
# We use the `:participating` notification level in order to match existing legacy behavior as captured
# in existing specs (notification_service_spec.rb ~ line 507)
# in existing specs (notification_service_spec.rb ~ line 507)
add_recipients
(
assignees
,
:participating
,
NotificationReason
::
ASSIGNED
)
if
assignees
add_recipients
(
assignees
,
:participating
,
NotificationReason
::
ASSIGNED
)
if
assignees
...
...
app/services/notification_service.rb
View file @
5f39f9b3
...
@@ -363,6 +363,19 @@ class NotificationService
...
@@ -363,6 +363,19 @@ class NotificationService
end
end
end
end
def
issue_due_email
(
issue
)
recipients
=
NotificationRecipientService
.
build_recipients
(
issue
,
issue
.
author
,
action:
"due_date"
,
skip_current_user:
false
,
)
recipients
.
each
do
|
recipient
|
mailer
.
send
(
:issue_due_email
,
recipient
.
user
.
id
,
issue
.
id
,
recipient
.
reason
).
deliver_later
end
end
protected
protected
def
new_resource_email
(
target
,
method
)
def
new_resource_email
(
target
,
method
)
...
...
app/views/notify/issue_due_email.html.haml
0 → 100644
View file @
5f39f9b3
-
if
Gitlab
::
CurrentSettings
.
email_author_in_body
%p
.details
#{
link_to
@issue
.
author_name
,
user_url
(
@issue
.
author
)
}
updated the issue's due date:
-
if
@issue
.
assignees
.
any?
%p
Assignee:
#{
@issue
.
assignee_list
}
%p
This Issue has a new due date:
#{
@issue
.
due_date
}
-
if
@issue
.
description
%div
=
markdown
(
@issue
.
description
,
pipeline: :email
,
author:
@issue
.
author
)
app/views/notify/issue_due_email.text.erb
0 → 100644
View file @
5f39f9b3
An Issue had its due date updated.
Issue
<%=
@issue
.
iid
%>
:
<%=
url_for
(
project_issue_url
(
@issue
.
project
,
@issue
))
%>
Author:
<%=
@issue
.
author_name
%>
Assignee:
<%=
@issue
.
assignee_list
%>
New Due Date:
<%=
@issue
.
due_date
%>
<%=
@issue
.
description
%>
app/workers/issue_due_worker.rb
View file @
5f39f9b3
...
@@ -3,9 +3,8 @@ class IssueDueWorker
...
@@ -3,9 +3,8 @@ class IssueDueWorker
def
perform
(
issue_id
)
def
perform
(
issue_id
)
issue
=
Issue
.
find_by_id
(
issue_id
)
issue
=
Issue
.
find_by_id
(
issue_id
)
# How do we want to deal with noops?
if
issue
.
due_date
==
Date
.
today
if
issue
.
due_date
==
Date
.
today
# execute
NotificationService
.
new
.
issue_due_email
(
issue
)
end
end
end
end
end
end
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