summaryrefslogtreecommitdiffstats
path: root/app/models/comment.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-10 17:13:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-10 17:13:09 +0000
commit0c78056a69cc3bee7fb1cd3261046995db55bfdf (patch)
tree67883c68edad43b2e6f96e9ea8b864370a6b207c /app/models/comment.rb
parent5533eeff239e024539f3ddd5b2ffe3528144beef (diff)
downloadredmine-0c78056a69cc3bee7fb1cd3261046995db55bfdf.tar.gz
redmine-0c78056a69cc3bee7fb1cd3261046995db55bfdf.zip
Send emails asynchronously (#26791).
Custom async_* delivery methods are removed in favor of ActiveJob (Async by default). git-svn-id: http://svn.redmine.org/redmine/trunk@17588 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/comment.rb')
-rw-r--r--app/models/comment.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 3b2044123..f2833ac6c 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -22,7 +22,7 @@ class Comment < ActiveRecord::Base
validates_presence_of :commented, :author, :content
- after_create :send_notification
+ after_create_commit :send_notification
safe_attributes 'comments'
@@ -37,9 +37,9 @@ class Comment < ActiveRecord::Base
private
def send_notification
- mailer_method = "#{commented.class.name.underscore}_comment_added"
- if Setting.notified_events.include?(mailer_method)
- Mailer.send(mailer_method, self).deliver
+ event = "#{commented.class.name.underscore}_comment_added"
+ if Setting.notified_events.include?(event)
+ Mailer.public_send("deliver_#{event}", self)
end
end
end