2014-09-02 18:07:02 +05:30
|
|
|
module Emails
|
|
|
|
module Issues
|
|
|
|
def new_issue_email(recipient_id, issue_id)
|
|
|
|
@issue = Issue.find(issue_id)
|
|
|
|
@project = @issue.project
|
2015-04-26 12:48:37 +05:30
|
|
|
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
|
2014-09-02 18:07:02 +05:30
|
|
|
mail_new_thread(@issue,
|
|
|
|
from: sender(@issue.author_id),
|
|
|
|
to: recipient(recipient_id),
|
|
|
|
subject: subject("#{@issue.title} (##{@issue.iid})"))
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
SentNotification.record(@issue, recipient_id, reply_key)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id, updated_by_user_id)
|
|
|
|
@issue = Issue.find(issue_id)
|
|
|
|
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
|
|
|
|
@project = @issue.project
|
2015-04-26 12:48:37 +05:30
|
|
|
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
|
2014-09-02 18:07:02 +05:30
|
|
|
mail_answer_thread(@issue,
|
|
|
|
from: sender(updated_by_user_id),
|
|
|
|
to: recipient(recipient_id),
|
|
|
|
subject: subject("#{@issue.title} (##{@issue.iid})"))
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
SentNotification.record(@issue, recipient_id, reply_key)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def closed_issue_email(recipient_id, issue_id, updated_by_user_id)
|
|
|
|
@issue = Issue.find issue_id
|
|
|
|
@project = @issue.project
|
|
|
|
@updated_by = User.find updated_by_user_id
|
2015-04-26 12:48:37 +05:30
|
|
|
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
|
2014-09-02 18:07:02 +05:30
|
|
|
mail_answer_thread(@issue,
|
|
|
|
from: sender(updated_by_user_id),
|
|
|
|
to: recipient(recipient_id),
|
|
|
|
subject: subject("#{@issue.title} (##{@issue.iid})"))
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
SentNotification.record(@issue, recipient_id, reply_key)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
|
|
|
|
@issue = Issue.find issue_id
|
|
|
|
@issue_status = status
|
|
|
|
@project = @issue.project
|
|
|
|
@updated_by = User.find updated_by_user_id
|
2015-04-26 12:48:37 +05:30
|
|
|
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
|
2014-09-02 18:07:02 +05:30
|
|
|
mail_answer_thread(@issue,
|
|
|
|
from: sender(updated_by_user_id),
|
|
|
|
to: recipient(recipient_id),
|
|
|
|
subject: subject("#{@issue.title} (##{@issue.iid})"))
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
SentNotification.record(@issue, recipient_id, reply_key)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|