]> source.dussan.org Git - redmine.git/commitdiff
Don't hardcode news model in Comment.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 15 Jul 2013 20:53:23 +0000 (20:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 15 Jul 2013 20:53:23 +0000 (20:53 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12026 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/comment.rb

index ac60e497ced45adbaf140aa70273ca4212029c47..d108cb103e82b02771308b444963f1c0f9569790 100644 (file)
@@ -29,8 +29,9 @@ class Comment < ActiveRecord::Base
   private
 
   def send_notification
-    if commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
-      Mailer.news_comment_added(self).deliver
+    mailer_method = "#{commented.class.name.underscore}_comment_added"
+    if Setting.notified_events.include?(mailer_method)
+      Mailer.send(mailer_method, self).deliver
     end
   end
 end