aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-11-15 17:39:33 +1300
committerPhilip Arndt <parndt@gmail.com>2010-11-15 17:39:52 +1300
commit5b55dc2f375cac1a78bc70150a9473a74271ffdd (patch)
tree6e8c3320ec2cbe40644390c79a776738eb572542 /app/controllers
parent426c0d913f62de7377d5b7dd3172f2e7117cfaec (diff)
downloadrefinerycms-blog-5b55dc2f375cac1a78bc70150a9473a74271ffdd.tar.gz
refinerycms-blog-5b55dc2f375cac1a78bc70150a9473a74271ffdd.tar.bz2
refinerycms-blog-5b55dc2f375cac1a78bc70150a9473a74271ffdd.zip
Added comment notifications.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/blog/posts_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb
index ee707ed..1d8a0b5 100644
--- a/app/controllers/blog/posts_controller.rb
+++ b/app/controllers/blog/posts_controller.rb
@@ -17,6 +17,18 @@ class Blog::PostsController < BlogController
def comment
if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
+ if BlogComment::Moderation.enabled? or @blog_comment.ham?
+ begin
+ if Rails.version < '3.0.0'
+ Blog::CommentMailer.deliver_notification(@blog_comment, request)
+ else
+ Blog::CommentMailer.notification(@blog_comment, request).deliver
+ end
+ rescue
+ logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
+ end
+ end
+
if BlogComment::Moderation.enabled?
flash[:notice] = t('blog.posts.comments.thank_you_moderated')
redirect_to blog_post_url(params[:id])