debian-mirror-gitlab/app/mailers/emails/issues.rb

71 lines
2.5 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Emails
module Issues
def new_issue_email(recipient_id, issue_id)
setup_issue_mail(issue_id, recipient_id)
mail_new_thread(@issue, issue_thread_options(@issue.author_id, recipient_id))
2014-09-02 18:07:02 +05:30
end
2016-09-13 17:45:13 +05:30
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
2014-09-02 18:07:02 +05:30
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id, updated_by_user_id)
setup_issue_mail(issue_id, recipient_id)
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
2014-09-02 18:07:02 +05:30
end
def closed_issue_email(recipient_id, issue_id, updated_by_user_id)
setup_issue_mail(issue_id, recipient_id)
2016-06-02 11:05:42 +05:30
@updated_by = User.find(updated_by_user_id)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
end
def relabeled_issue_email(recipient_id, issue_id, label_names, updated_by_user_id)
setup_issue_mail(issue_id, recipient_id)
@label_names = label_names
@labels_url = namespace_project_labels_url(@project.namespace, @project)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
2014-09-02 18:07:02 +05:30
end
def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
setup_issue_mail(issue_id, recipient_id)
@issue_status = status
2016-06-02 11:05:42 +05:30
@updated_by = User.find(updated_by_user_id)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
2015-12-23 02:04:40 +05:30
end
2016-06-02 11:05:42 +05:30
def issue_moved_email(recipient, issue, new_issue, updated_by_user)
setup_issue_mail(issue.id, recipient.id)
2015-12-23 02:04:40 +05:30
2016-06-02 11:05:42 +05:30
@new_issue = new_issue
@new_project = new_issue.project
mail_answer_thread(issue, issue_thread_options(updated_by_user.id, recipient.id))
2015-12-23 02:04:40 +05:30
end
2016-06-02 11:05:42 +05:30
private
def setup_issue_mail(issue_id, recipient_id)
2015-12-23 02:04:40 +05:30
@issue = Issue.find(issue_id)
2014-09-02 18:07:02 +05:30
@project = @issue.project
2015-04-26 12:48:37 +05:30
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
2015-12-23 02:04:40 +05:30
@sent_notification = SentNotification.record(@issue, recipient_id, reply_key)
2014-09-02 18:07:02 +05:30
end
2016-06-02 11:05:42 +05:30
def issue_thread_options(sender_id, recipient_id)
{
from: sender(sender_id),
to: recipient(recipient_id),
subject: subject("#{@issue.title} (##{@issue.iid})")
}
end
2014-09-02 18:07:02 +05:30
end
end