2013-03-19 18:00:41 +00:00
|
|
|
module Emails
|
|
|
|
module Issues
|
2013-03-28 10:52:44 +00:00
|
|
|
def new_issue_email(recipient_id, issue_id)
|
2015-12-09 10:59:25 +00:00
|
|
|
setup_issue_mail(issue_id, recipient_id)
|
|
|
|
|
|
|
|
mail_new_thread(@issue, issue_thread_options(@issue.author_id, recipient_id))
|
2013-03-19 18:00:41 +00:00
|
|
|
end
|
|
|
|
|
2016-08-12 21:54:32 +00:00
|
|
|
def new_mention_in_issue_email(recipient_id, issue_id, updated_by_user_id)
|
|
|
|
setup_issue_mail(issue_id, recipient_id)
|
|
|
|
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
|
|
|
|
end
|
|
|
|
|
2017-05-04 12:11:15 +00:00
|
|
|
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_ids, updated_by_user_id)
|
2015-12-09 10:59:25 +00:00
|
|
|
setup_issue_mail(issue_id, recipient_id)
|
|
|
|
|
2017-05-04 12:11:15 +00:00
|
|
|
@previous_assignees = []
|
|
|
|
@previous_assignees = User.where(id: previous_assignee_ids) if previous_assignee_ids.any?
|
|
|
|
|
2015-12-09 10:59:25 +00:00
|
|
|
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
|
2013-03-19 18:00:41 +00:00
|
|
|
end
|
|
|
|
|
2013-03-28 10:24:04 +00:00
|
|
|
def closed_issue_email(recipient_id, issue_id, updated_by_user_id)
|
2015-12-09 10:59:25 +00:00
|
|
|
setup_issue_mail(issue_id, recipient_id)
|
|
|
|
|
2016-02-12 14:58:39 +00:00
|
|
|
@updated_by = User.find(updated_by_user_id)
|
|
|
|
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
|
|
|
|
end
|
|
|
|
|
2016-03-01 16:33:13 +00:00
|
|
|
def relabeled_issue_email(recipient_id, issue_id, label_names, updated_by_user_id)
|
2016-03-15 16:24:55 +00:00
|
|
|
setup_issue_mail(issue_id, recipient_id)
|
2016-03-01 16:33:13 +00:00
|
|
|
|
2016-02-12 14:58:39 +00:00
|
|
|
@label_names = label_names
|
2017-06-29 17:06:35 +00:00
|
|
|
@labels_url = project_labels_url(@project)
|
2015-12-09 10:59:25 +00:00
|
|
|
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
|
2013-03-28 10:14:53 +00:00
|
|
|
end
|
|
|
|
|
2013-03-19 18:00:41 +00:00
|
|
|
def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
|
2015-12-09 10:59:25 +00:00
|
|
|
setup_issue_mail(issue_id, recipient_id)
|
|
|
|
|
|
|
|
@issue_status = status
|
2016-02-12 14:58:39 +00:00
|
|
|
@updated_by = User.find(updated_by_user_id)
|
2015-12-09 10:59:25 +00:00
|
|
|
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
|
2015-11-16 22:53:21 +00:00
|
|
|
end
|
|
|
|
|
2016-03-15 10:35:40 +00:00
|
|
|
def issue_moved_email(recipient, issue, new_issue, updated_by_user)
|
|
|
|
setup_issue_mail(issue.id, recipient.id)
|
|
|
|
|
|
|
|
@new_issue = new_issue
|
|
|
|
@new_project = new_issue.project
|
|
|
|
mail_answer_thread(issue, issue_thread_options(updated_by_user.id, recipient.id))
|
|
|
|
end
|
|
|
|
|
2015-11-17 10:55:43 +00:00
|
|
|
private
|
|
|
|
|
2016-03-15 16:24:55 +00:00
|
|
|
def setup_issue_mail(issue_id, recipient_id)
|
2016-03-01 16:33:13 +00:00
|
|
|
@issue = Issue.find(issue_id)
|
|
|
|
@project = @issue.project
|
2017-06-29 17:06:35 +00:00
|
|
|
@target_url = project_issue_url(@project, @issue)
|
2016-03-01 16:33:13 +00:00
|
|
|
|
2016-03-15 16:24:55 +00:00
|
|
|
@sent_notification = SentNotification.record(@issue, recipient_id, reply_key)
|
2016-03-01 16:33:13 +00:00
|
|
|
end
|
|
|
|
|
2015-11-17 10:55:43 +00:00
|
|
|
def issue_thread_options(sender_id, recipient_id)
|
2015-11-16 22:53:21 +00:00
|
|
|
{
|
|
|
|
from: sender(sender_id),
|
|
|
|
to: recipient(recipient_id),
|
|
|
|
subject: subject("#{@issue.title} (##{@issue.iid})")
|
|
|
|
}
|
|
|
|
end
|
2013-03-19 18:00:41 +00:00
|
|
|
end
|
|
|
|
end
|