about summary refs log tree commit diff stats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/comments_controller.rb4
-rw-r--r--app/controllers/comments_controller.rb6
2 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index ccde3e6..9958232 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb
@@ -14,6 +14,10 @@ class Admin::CommentsController < Admin::AdminController
14 @comment.status = :published 14 @comment.status = :published
15 @comment.save! 15 @comment.save!
16 16
17 if @comment.reply_to and @comment.reply_to.email != @comment.blog.user.email and @comment.reply_to.email != current_user.email
18 CommentMailer.with(comment: @comment).reply_comment_email.deliver_later
19 end
20
17 flash.notice = "Comment successfully published." 21 flash.notice = "Comment successfully published."
18 redirect_to pending_admin_comments_url 22 redirect_to pending_admin_comments_url
19 end 23 end
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index a444dba..2f3117f 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb
@@ -46,6 +46,10 @@ class CommentsController < ApplicationController
46 46
47 if @comment.status == :published 47 if @comment.status == :published
48 CommentMailer.with(comment: @comment).new_comment_email.deliver_later 48 CommentMailer.with(comment: @comment).new_comment_email.deliver_later
49
50 if @comment.reply_to and @comment.reply_to.email != @comment.blog.user.email
51 CommentMailer.with(comment: @comment).reply_comment_email.deliver_later
52 end
49 else 53 else
50 CommentMailer.with(comment: @comment).new_pending_comment_email.deliver_later 54 CommentMailer.with(comment: @comment).new_pending_comment_email.deliver_later
51 end 55 end
@@ -60,6 +64,6 @@ class CommentsController < ApplicationController
60 private 64 private
61 65
62 def comment_params 66 def comment_params
63 params.require(:comment).permit(:username, :email, :website, :body) 67 params.require(:comment).permit(:username, :email, :website, :body, :reply_to_id)
64 end 68 end
65end 69end