Sha256: 5b96b79aa0da78478228ad21336792d99d35ba3096a8e3a35513a4a27086c9af

Contents?: true

Size: 760 Bytes

Versions: 5

Compression:

Stored size: 760 Bytes

Contents

class CommentMailer < ActionMailer::Base
  
  def new_comment(comment)
    if comment.user
      display_name = comment.user.display_name
    else
      display_name = I18n.t('muck.comment.anonymous')
    end
    @comment = comment
    @display_name = display_name
    mail(:to => emails_for_comment(comment), :subject => I18n.t('muck.comments.new_comment_email_subject', :name => display_name, :application_name => MuckEngine.configuration.application_name)) do |format|
      format.html
      format.text
    end
  end
  
  protected
    def emails_for_comment(comment)
      emails = []
      comment.root.self_and_descendants.each do |c|
        emails << c.user.email unless emails.include?(c.user.email) if c.user
      end
      emails
    end
    
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
muck-comments-3.2.0 app/mailers/comment_mailer.rb
muck-comments-3.1.0 app/mailers/comment_mailer.rb
muck-comments-3.0.2 app/mailers/comment_mailer.rb
muck-comments-3.0.1 app/mailers/comment_mailer.rb
muck-comments-3.0.0 app/mailers/comment_mailer.rb