diff options
author | jomo <github@jomo.tv> | 2015-02-08 01:47:20 +0100 |
---|---|---|
committer | jomo <github@jomo.tv> | 2015-02-08 01:47:20 +0100 |
commit | 61f51666fb7df03f4405f987a4e01ad5d9cd2fee (patch) | |
tree | 283feb76ffbdbf2e847355f40f2a68bb16791bcd /app/models | |
parent | 8af9d9922bf0037cf3d608c1803e4e83555c879b (diff) |
remove thread mention mail, use reply mail instead
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/comment.rb | 2 | ||||
-rw-r--r-- | app/models/threadreply.rb | 31 |
2 files changed, 9 insertions, 24 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb index 6f6439b..35a9a60 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -32,8 +32,6 @@ class Comment < ActiveRecord::Base 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? diff --git a/app/models/threadreply.rb b/app/models/threadreply.rb index b925b0e..1ca428d 100644 --- a/app/models/threadreply.rb +++ b/app/models/threadreply.rb @@ -33,32 +33,19 @@ class Threadreply < ActiveRecord::Base !!user_editor_id 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_thread_reply_mention_mail(user, self) if user.normal? && user.confirmed? && self.thread.can_read?(user) && user.mail_mention? - rescue => e - Rails.logger.error "---" - Rails.logger.error "WARNING: Failed to create new_thread_reply_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 - - def send_new_reply_mail - userids = [] + def send_new_reply_mail(old_content = "") + userids = new_mentions = mentions(content) - mentions(old_content) # thread + replies posts = thread.replies.to_a posts << thread if thread.author.mail_own_thread_reply? - posts.each do |post| - # don't send mail to the author of this reply, don't send to banned/disabled users - if post.author != author && post.author.normal? && post.author.confirmed? # && - userids << post.author.id if post.author.mail_other_thread_reply? + # only send "reply" mail when reply is new + unless old_content.present? + posts.each do |post| + # don't send mail to the author of this reply, don't send to banned/disabled users + if post.author != author && post.author.normal? && post.author.confirmed? # && + userids << post.author.id if post.author.mail_other_thread_reply? + end end end # making sure we don't send multiple mails to the same user |