Sha256: a1ad4fa37e078ca0aa102b8a5e561932763da024ef07a4a750f3358b55b565ef

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

module Commontator
  class SubscriptionsMailer < ActionMailer::Base
    def comment_created(comment, recipients)
      setup_variables(comment, recipients)

      mail :to => @to,
           :bcc => @bcc,
           :from => @from,
           :subject => t('commontator.email.comment_created.subject',
                         :creator_name => @creator_name,
                         :commontable_name => @commontable_name,
                         :commontable_url => @commontable_url)
    end

    protected

    def setup_variables(comment, recipients)
      @comment = comment
      @thread = @comment.thread
      @creator = @comment.creator

      @creator_name = Commontator.commontator_name(@creator)

      @commontable_name = Commontator.commontable_name(@thread)

      @commontable_url = Commontator.commontable_url(@thread, main_app)

      params = Hash.new
      params[:comment] = @comment
      params[:thread] = @thread
      params[:creator] = @creator
      params[:creator_name] = @creator_name
      params[:commontable_name] = @commontable_name
      params[:commontable_url] = @commontable_url

      @to = t('commontator.email.undisclosed_recipients')
      @bcc = recipients.collect{|s| Commontator.commontator_email(s, self)}
      @from = @thread.config.email_from_proc.call(@thread)
    end

    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
commontator-4.10.5 app/mailers/commontator/subscriptions_mailer.rb
commontator-4.10.4 app/mailers/commontator/subscriptions_mailer.rb
commontator-4.10.3 app/mailers/commontator/subscriptions_mailer.rb
commontator-4.10.2 app/mailers/commontator/subscriptions_mailer.rb
commontator-4.10.1 app/mailers/commontator/subscriptions_mailer.rb
commontator-4.10.0 app/mailers/commontator/subscriptions_mailer.rb
commontator-4.9.0 app/mailers/commontator/subscriptions_mailer.rb