Sha256: a84380bbfb06ca0f5a2b64cd596bf0526b240f81893354ef71ded9275b77479e

Contents?: true

Size: 1.13 KB

Versions: 16

Compression:

Stored size: 1.13 KB

Contents

class NotificationMailer < ActionMailer::Base
  helper :mail
  
  def article(article, user)
    setup(user, article)
    @subject        = "[#{article.blog.blog_name}] New article: #{article.title}"
    @body[:article] = article
  end

  def comment(comment, user)
    setup(user, comment)
    @subject        = "[#{comment.blog.blog_name}] New comment on #{comment.article.title}"
    @body[:article] = comment.article
    @body[:comment] = comment
  end

  def trackback(sent_at = Time.now)
    setup(user, trackback)
    @subject          = "[#{trackback.blog.blog_name}] New trackback on #{trackback.article.title}"
    @body[:article]   = trackback.article
    @body[:trackback] = trackback
  end

  def notif_user(user)
    @body[:user] = user
    @body[:blog] = Blog.default
    @recipients  = user.email
    @from        = Blog.default.email_from
    @headers     = {'X-Mailer' => "Typo #{TYPO_VERSION}"}
  end

  private
  def setup(user, content)
    @body[:user] = user
    @body[:blog] = content.blog
    @recipients  = user.email
    @from        = content.blog.email_from
    @headers     = {'X-Mailer' => "Typo #{TYPO_VERSION}"}
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
typo-5.5 app/models/notification_mailer.rb
typo-5.4.4 app/models/notification_mailer.rb
typo-5.4.3 app/models/notification_mailer.rb
typo-5.4.2 app/models/notification_mailer.rb
typo-5.4.1 app/models/notification_mailer.rb
typo-5.4 app/models/notification_mailer.rb
typo-5.0.3.98.1 app/models/notification_mailer.rb
typo-5.0.3.98 app/models/notification_mailer.rb
typo-5.1.1 app/models/notification_mailer.rb
typo-5.1.2 app/models/notification_mailer.rb
typo-5.1.3 app/models/notification_mailer.rb
typo-5.1 app/models/notification_mailer.rb
typo-5.1.98 app/models/notification_mailer.rb
typo-5.2.98 app/models/notification_mailer.rb
typo-5.2 app/models/notification_mailer.rb
typo-5.3 app/models/notification_mailer.rb