diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-17 13:55:43 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-17 13:55:43 +0300 |
commit | 616675b4a6ef63abed2d133333fe5f5fbe1d73c6 (patch) | |
tree | c0495e6f19134f4c95288d4bf0c352005b4419cb /app/mailers/emails/issues.rb | |
parent | 4747412a49baf2d4776833e962e82b8cc893a06a (diff) |
Remove duplication in mailers/emails/notes.rb
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/mailers/emails/issues.rb')
-rw-r--r-- | app/mailers/emails/issues.rb | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index 11533bc53c6..abdeefed5ef 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -1,34 +1,36 @@ module Emails module Issues def new_issue_email(recipient_id, issue_id) - mail_with_notification(issue_id, recipient_id) do - mail_new_thread(@issue, thread_options(@issue.author_id, recipient_id)) + issue_mail_with_notification(issue_id, recipient_id) do + mail_new_thread(@issue, issue_thread_options(@issue.author_id, recipient_id)) end end def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id, updated_by_user_id) - mail_with_notification(issue_id, recipient_id) do + issue_mail_with_notification(issue_id, recipient_id) do @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id - mail_answer_thread(@issue, thread_options(updated_by_user_id, recipient_id)) + mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id)) end end def closed_issue_email(recipient_id, issue_id, updated_by_user_id) - mail_with_notification(issue_id, recipient_id) do + issue_mail_with_notification(issue_id, recipient_id) do @updated_by = User.find updated_by_user_id - mail_answer_thread(@issue, thread_options(updated_by_user_id, recipient_id)) + mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id)) end end def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) - mail_with_notification(issue_id, recipient_id) do + issue_mail_with_notification(issue_id, recipient_id) do @issue_status = status @updated_by = User.find updated_by_user_id - mail_answer_thread(@issue, thread_options(updated_by_user_id, recipient_id)) + mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id)) end end - def thread_options(sender_id, recipient_id) + private + + def issue_thread_options(sender_id, recipient_id) { from: sender(sender_id), to: recipient(recipient_id), @@ -36,7 +38,7 @@ module Emails } end - def mail_with_notification(issue_id, recipient_id) + def issue_mail_with_notification(issue_id, recipient_id) @issue = Issue.find(issue_id) @project = @issue.project @target_url = namespace_project_issue_url(@project.namespace, @project, @issue) |