Skip to content
Snippets Groups Projects
Commit 5f39f9b3 authored by Stuart Nelson's avatar Stuart Nelson Committed by Sean McGivern
Browse files

Send email to recipients

parent bebced8f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6,6 +6,12 @@ module Emails
mail_new_thread(@issue, issue_thread_options(@issue.author_id, recipient_id, reason))
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)
setup_issue_mail(issue_id, recipient_id)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id, reason))
Loading
Loading
Loading
Loading
@@ -230,14 +230,20 @@ module NotificationRecipientService
 
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
# type ensures that users with the mention notification level will
# receive them, too.
add_mentions(current_user, target: target)
 
# 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
# in existing specs (notification_service_spec.rb ~ line 507)
add_recipients(assignees, :participating, NotificationReason::ASSIGNED) if assignees
Loading
Loading
Loading
Loading
@@ -363,6 +363,19 @@ class NotificationService
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
 
def new_resource_email(target, method)
Loading
Loading
- 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)
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 %>
Loading
Loading
@@ -3,9 +3,8 @@ class IssueDueWorker
 
def perform(issue_id)
issue = Issue.find_by_id(issue_id)
# How do we want to deal with noops?
if issue.due_date == Date.today
# execute
NotificationService.new.issue_due_email(issue)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment