remove comment mention mail, use reply mail instead
This commit is contained in:
@@ -29,16 +29,21 @@ class Comment < ActiveRecord::Base
|
||||
!!user_editor_id
|
||||
end
|
||||
|
||||
def send_new_comment_mail
|
||||
userids = []
|
||||
def send_new_comment_mail(old_content = "")
|
||||
userids = mentions(content) - mentions(old_content)
|
||||
|
||||
puts "userids: #{userids}"
|
||||
|
||||
# post + comments
|
||||
comments = blogpost.comments.to_a
|
||||
comments << blogpost if blogpost.author.mail_own_blogpost_comment?
|
||||
comments.each do |comment|
|
||||
# don't send mail to the author of this comment, don't send to banned/disabled users
|
||||
if comment.author != author && comment.author.normal? && comment.author.confirmed? # &&
|
||||
userids << comment.author.id if comment.author.mail_other_blogpost_comment?
|
||||
# only send "reply" mails when the comment is new
|
||||
unless old_content.present?
|
||||
comments.each do |comment|
|
||||
# don't send mail to the author of this comment, don't send to banned/disabled users
|
||||
if comment.author != author && comment.author.normal? && comment.author.confirmed? # &&
|
||||
userids << comment.author.id if comment.author.mail_other_blogpost_comment?
|
||||
end
|
||||
end
|
||||
end
|
||||
# making sure we don't send multiple mails to the same user
|
||||
@@ -58,19 +63,4 @@ class Comment < ActiveRecord::Base
|
||||
background_mailer(mails)
|
||||
end
|
||||
|
||||
def send_new_mention_mail(old_content = "")
|
||||
new_mentions = mentions(content) - mentions(old_content)
|
||||
mails = []
|
||||
new_mentions.each do |user|
|
||||
begin
|
||||
mails << RedstonerMailer.new_post_comment_mention_mail(user, self) if user.normal? && user.confirmed? && user.mail_mention?
|
||||
rescue => e
|
||||
Rails.logger.error "---"
|
||||
Rails.logger.error "WARNING: Failed to create new_post_comment_mention_mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||
Rails.logger.error e.message
|
||||
Rails.logger.error "---"
|
||||
end
|
||||
end
|
||||
background_mailer(mails)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user