Permalink
Browse files

Issue #2378: general admin mailing list for comments on admin posts

  • Loading branch information...
1 parent 5845103 commit 916d442065f805a4ae52f339ca7d724488c4716e @CristinaRO CristinaRO committed Jul 11, 2012
Showing with 23 additions and 20 deletions.
  1. +6 −6 app/mailers/admin_mailer.rb
  2. +16 −14 app/models/comment_observer.rb
  3. +1 −0 config/config.yml
@@ -42,21 +42,21 @@ def archive_notification(admin_login, user_ids, subject, message)
end
# Sends email to an admin when a new comment is created on an admin post
- def comment_notification(admin_id, comment_id)
- admin = Admin.find(admin_id)
+ def comment_notification(comment_id)
+ # admin = Admin.find(admin_id)
@comment = Comment.find(comment_id)
mail(
- :to => admin.email,
+ :to => ArchiveConfig.ADMIN_ADDRESS,
:subject => "[#{ArchiveConfig.APP_SHORT_NAME}] Comment on " + (@comment.ultimate_parent.is_a?(Tag) ? "the tag " : "") + @comment.ultimate_parent.commentable_name
)
end
# Sends email to an admin when a comment on an admin post is edited
- def edited_comment_notification(admin_id, comment_id)
- admin = Admin.find(admin_id)
+ def edited_comment_notification(comment_id)
+ # admin = Admin.find(admin_id)
@comment = Comment.find(comment_id)
mail(
- :to => admin.email,
+ :to => ArchiveConfig.ADMIN_ADDRESS,
:subject => "[#{ArchiveConfig.APP_SHORT_NAME}] Edited comment on " + (@comment.ultimate_parent.is_a?(Tag) ? "the tag " : "") + @comment.ultimate_parent.commentable_name
)
end
@@ -45,14 +45,15 @@ def after_create(comment)
# send notification to the owner(s) of the ultimate parent, who can be users or admins
if comment.ultimate_parent.is_a?(AdminPost)
- admins = comment.ultimate_parent.commentable_owners
- admins.each do |admin|
- # TODO: comments should be able to belong to an admin officially
- # right now comment.comment_owner is nil for an admin, and going by email is not reliable
- # unless admin == comment.comment_owner
- AdminMailer.comment_notification(admin.id, comment.id).deliver
- # end
- end
+ # admins = comment.ultimate_parent.commentable_owners
+ # admins.each do |admin|
+ # # TODO: comments should be able to belong to an admin officially
+ # # right now comment.comment_owner is nil for an admin, and going by email is not reliable
+ # # unless admin == comment.comment_owner
+ # AdminMailer.comment_notification(admin.id, comment.id).deliver
+ # # end
+ # end
+ AdminMailer.comment_notification(comment.id).deliver
else
# at this point, users contains those who've already been notified
if users.empty?
@@ -115,12 +116,13 @@ def after_update(comment)
# send notification to the owner(s) of the ultimate parent, who can be users or admins
if comment.ultimate_parent.is_a?(AdminPost)
- admins = comment.ultimate_parent.commentable_owners
- admins.each do |admin|
- # TODO: comments should be able to belong to an admin officially
- # unless admin == comment.comment_owner
- AdminMailer.edited_comment_notification(admin.id, comment.id).deliver
- end
+ # admins = comment.ultimate_parent.commentable_owners
+ # admins.each do |admin|
+ # # TODO: comments should be able to belong to an admin officially
+ # # unless admin == comment.comment_owner
+ # AdminMailer.edited_comment_notification(admin.id, comment.id).deliver
+ # end
+ AdminMailer.edited_comment_notification(comment.id).deliver
else
# at this point, users contains those who've already been notified
if users.empty?
View
@@ -15,6 +15,7 @@ SESSION_SECRET: '898f6d0363863ec79d782238cd1c5767636d712cc0d138238bcd5bfc9d2672f
RETURN_ADDRESS: 'do-not-reply@example.org'
SUPPORT_ADDRESS: 'support@example.org'
ABUSE_ADDRESS: 'abuse@example.org'
+ADMIN_ADDRESS: 'admin@example.org'
QUESTION_ADDRESS: 'questions@example.org'
WEBMASTER_ADDRESS: 'webmaster@example.org'
ERROR_ADDRESS: errors@example.org

0 comments on commit 916d442

Please sign in to comment.