Skip to content
Browse files

Fixed up notifications.

  • Loading branch information...
1 parent e68ac0e commit ca9d295d30a1e23fcba65fb80a7613482d7bc69d @ntalbott ntalbott committed
View
2 app/controllers/comments_controller.rb
@@ -19,7 +19,7 @@ def create
if !comment.is_spam?
comment.save!
ResponseCache.instance.clear
- CommentMailer.deliver_comment_notification if Radiant::Config['comments.notification'] == "true"
+ CommentMailer.deliver_comment_notification("http://#{request.host}:#{request.port}/admin/comments?status=unapproved") if Radiant::Config['comments.notification'] == "true"
redirect_to "#{page.url}#comment_saved"
else
redirect_to "#{page.url}#comment_rejected"
View
11 app/models/comment_mailer.rb
@@ -1,10 +1,11 @@
class CommentMailer < ActionMailer::Base
- def comment_notification(sent_at = Time.now)
- @subject = "[ AS Website ] New comment posted requires approval"
- @body = {}
- @recipients = "admin@example.com"
- @from = "admin@example.com"
+ def comment_notification(url, sent_at = Time.now)
+ site_name = Radiant::Config['comments.notification_site_name']
+ @subject = "New comment posted requires approval"
+ @body = {@name = site_name, @url = url}
+ @recipients = Radiant::Config['comments.notification_to']
+ @from = Radiant::Config['comments.notification_from']
@sent_on = sent_at
end
end
View
4 app/views/comment_mailer/comment_notification.rhtml
@@ -1,3 +1,3 @@
-A new comment has been posted on the AS Website. Comments require your approval before they will become visible.
+A new comment has been posted on the <%= @name %> site. Comments require your approval before they will become visible.
-http://as.biola.edu/admin/comments?status=unapproved
+ <%= @url %>
View
1 comments_extension.rb
@@ -37,6 +37,7 @@ def activate
{ 'notification' => 'false',
'notification_from' => '',
'notification_to' => '',
+ 'notification_site_name' => '',
'akismet_key' => '',
'akismet_url' => '',
'filters_enabled' => 'true',

0 comments on commit ca9d295

Please sign in to comment.
Something went wrong with that request. Please try again.