diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-19 12:35:23 -0700 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-19 12:35:23 -0700 |
commit | 992dbbd9fe619ab3002f7c0c552657da8269df49 (patch) | |
tree | 5ae59f108ffe8d208928e7d2c2265018e033ad26 /app/mailers | |
parent | a8a861ae2a122b310d1aca6f9f9b1d0601b8c49f (diff) | |
download | gitlab-ce-992dbbd9fe619ab3002f7c0c552657da8269df49.tar.gz |
Move `sent_notification!` out of Notify.
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/issues.rb | 8 | ||||
-rw-r--r-- | app/mailers/emails/merge_requests.rb | 10 | ||||
-rw-r--r-- | app/mailers/emails/notes.rb | 6 | ||||
-rw-r--r-- | app/mailers/notify.rb | 21 |
4 files changed, 12 insertions, 33 deletions
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index c8b7775c328..2c035fbb70b 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -9,7 +9,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) - sent_notification!(@issue, recipient_id) + SentNotification.record(@issue, recipient_id, reply_key) end def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id, updated_by_user_id) @@ -22,7 +22,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) - sent_notification!(@issue, recipient_id) + SentNotification.record(@issue, recipient_id, reply_key) end def closed_issue_email(recipient_id, issue_id, updated_by_user_id) @@ -35,7 +35,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) - sent_notification!(@issue, recipient_id) + SentNotification.record(@issue, recipient_id, reply_key) end def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) @@ -49,7 +49,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) - sent_notification!(@issue, recipient_id) + SentNotification.record(@issue, recipient_id, reply_key) end end end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 76902b58f32..7923fb770d0 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -11,7 +11,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - sent_notification!(@merge_request, recipient_id) + SentNotification.record(@merge_request, recipient_id, reply_key) end def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id, updated_by_user_id) @@ -26,7 +26,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - sent_notification!(@merge_request, recipient_id) + SentNotification.record(@merge_request, recipient_id, reply_key) end def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) @@ -41,7 +41,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - sent_notification!(@merge_request, recipient_id) + SentNotification.record(@merge_request, recipient_id, reply_key) end def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) @@ -55,7 +55,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - sent_notification!(@merge_request, recipient_id) + SentNotification.record(@merge_request, recipient_id, reply_key) end def merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id) @@ -71,7 +71,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - sent_notification!(@merge_request, recipient_id) + SentNotification.record(@merge_request, recipient_id, reply_key) end end end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 2612074a5ff..63d4aca61af 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -12,7 +12,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@commit.title} (#{@commit.short_id})")) - sent_notification!(@commit, recipient_id) + SentNotification.record(@commit, recipient_id, reply_key) end def note_issue_email(recipient_id, note_id) @@ -27,7 +27,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) - sent_notification!(@issue, recipient_id) + SentNotification.record(@issue, recipient_id, reply_key) end def note_merge_request_email(recipient_id, note_id) @@ -43,7 +43,7 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) - sent_notification!(@merge_request, recipient_id) + SentNotification.record(@merge_request, recipient_id, reply_key) end end end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 1a2286f9d47..5717c89e61d 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -33,27 +33,6 @@ class Notify < BaseMailer allowed_domains end - def sent_notification!(noteable, recipient_id) - return unless reply_key - - noteable_id = nil - commit_id = nil - if noteable.is_a?(Commit) - commit_id = noteable.id - else - noteable_id = noteable.id - end - - SentNotification.create( - project: noteable.project, - noteable_type: noteable.class.name, - noteable_id: noteable_id, - commit_id: commit_id, - recipient_id: recipient_id, - reply_key: reply_key - ) - end - private def can_send_from_user_email?(sender) |