Sha256: 9bbaed587268cbad93b9dac12d0e0169f331a470242250c20b2696b6b23b6dd9

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

module Commontator
  class SubscriptionMailer < ActionMailer::Base
  
    include CommentsHelper
    include ThreadsHelper
  
    def comment_created_email(comment) 
      setup_variables(comment)

      mail(:bcc => @bcc,
           :subject => @subject,
           :body => @body)
    end

protected

    def setup_variables(comment)
      @comment = comment
      @thread = @comment.thread
      @commontator = @comment.commontator
      @commontable = @thread.commontable
      @config = @thread.config
      @bcc = @thread.subscribers.reject{|s| s == @commontator}\
                                .collect{|s| email(s)}
                                
      @commontator_name = commontator_name(@commontator)
      @comment_timestamp = comment_timestamp(@comment)
      
      @commontable_name = commontable_name(@thread)
      @commontable_id = commontable_id(@thread).to_s
      
      @subject = eval(@config.subscription_email_subject)
      @body = @config.subscription_email_body.blank? ? nil : \
                eval(@config.subscription_email_body)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
commontator-0.4.1 app/mailers/commontator/subscription_mailer.rb~
commontator-0.3.10 app/mailers/commontator/subscription_mailer.rb~
commontator-0.2.4 app/mailers/commontator/subscription_mailer.rb~
commontator-0.2.0 app/mailers/commontator/subscription_mailer.rb~
commontator-0.1.46 app/mailers/commontator/subscription_mailer.rb~