mentioning
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class Threadreply < ActiveRecord::Base
|
||||
|
||||
include MailerHelper
|
||||
include UsersHelper
|
||||
|
||||
belongs_to :forumthread
|
||||
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||
@@ -32,6 +33,22 @@ 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)
|
||||
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 = []
|
||||
|
||||
@@ -53,7 +70,7 @@ class Threadreply < ActiveRecord::Base
|
||||
mails << RedstonerMailer.new_thread_reply_mail(User.find(uid), self)
|
||||
rescue => e
|
||||
Rails.logger.error "---"
|
||||
Rails.logger.error "WARNING: Failed to create thread_reply mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||
Rails.logger.error "WARNING: Failed to create new_thread_reply_mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||
Rails.logger.error e.message
|
||||
Rails.logger.error "---"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user