From 9ad3bca2ea475b709c8311ab25194e4578c1a0d9 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 12 Oct 2023 21:51:02 -0400 Subject: Webmaster gets an email when a comment is posted --- app/controllers/comments_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 60c8f6a..c66365b 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -43,6 +43,10 @@ class CommentsController < ApplicationController if @comment.save flash.notice = flash_message + + if @comment.status == :published + CommentMailer.with(comment: @comment).new_comment_email.deliver_later + end else flash.alert = "Error posting comment." end -- cgit 1.4.1