Sha256: 5311e0f300e7c3c50a244e51ff9422d2dcd99b4ca8d4345f0c8f343292b0dd8d

Contents?: true

Size: 1.16 KB

Versions: 12

Compression:

Stored size: 1.16 KB

Contents

class CommentMailer < ActionMailer::Base
  unloadable
  layout 'email_default'
  default_url_options[:host] = GlobalConfig.application_url
  
  def new_comment(comment)
    if comment.user
      display_name = comment.user.display_name
    else
      display_name = I18n.t('muck.comment.anonymous')
    end
    recipients    emails_for_comment(comment)
    from          "#{GlobalConfig.from_email_name} <#{GlobalConfig.from_email}>"
    sent_on       Time.now
    content_type  "text/html" # There is a bug in Rails that prevents multipart emails from working inside an engine.  See: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2263-rails-232-breaks-implicit-multipart-actionmailer-tests#ticket-2263-22
    subject       I18n.t('muck.comments.new_comment_email_subject', :name => display_name, :application_name => GlobalConfig.application_name)
    body          :comment => comment, :display_name => display_name
  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

12 entries across 12 versions & 1 rubygems

Version Path
muck-comments-0.1.21 app/models/comment_mailer.rb
muck-comments-0.1.20 app/models/comment_mailer.rb
muck-comments-0.1.19 app/models/comment_mailer.rb
muck-comments-0.1.18 app/models/comment_mailer.rb
muck-comments-0.1.17 app/models/comment_mailer.rb
muck-comments-0.1.16 app/models/comment_mailer.rb
muck-comments-0.1.15 app/models/comment_mailer.rb
muck-comments-0.1.14 app/models/comment_mailer.rb
muck-comments-0.1.13 app/models/comment_mailer.rb
muck-comments-0.1.12 app/models/comment_mailer.rb
muck-comments-0.1.11 app/models/comment_mailer.rb
muck-comments-0.1.10 app/models/comment_mailer.rb