Sha256: d44b7ef79f143cbe5d9c501ad23e7b5dc4cf3985a9003255f3d63cd9de11e87f

Contents?: true

Size: 867 Bytes

Versions: 9

Compression:

Stored size: 867 Bytes

Contents

class NotificationMailer < ActionMailer::Base
  helper :base
  layout nil

  def article(article, user)
    @user = user
    @blog = article.blog
    @article = article
    build_mail @blog, @user, "New article: #{article.title}"
  end

  def comment(comment, user)
    @user = user
    @blog = comment.blog
    @comment = comment
    build_mail @blog, @user, "New comment on #{comment.article.title}"
  end

  def notif_user(user)
    @user = user
    # TODO: Make user blog-dependent
    @blog = Blog.first
    build_mail @blog, @user, 'Welcome to Publify'
  end

  private

  def make_subject(blog, subject)
    "[#{blog.blog_name}] #{subject}"
  end

  def build_mail(blog, user, subject)
    headers['X-Mailer'] = "Publify #{PublifyCore::VERSION}"
    mail(from: blog.email_from,
         to: user.email,
         subject: make_subject(blog, subject))
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
publify_core-9.1.0 app/mailers/notification_mailer.rb
publify_core-9.0.1 app/mailers/notification_mailer.rb
publify_core-9.0.0 app/mailers/notification_mailer.rb
publify_core-9.0.0.pre6 app/mailers/notification_mailer.rb
publify_core-9.0.0.pre5 app/mailers/notification_mailer.rb
publify_core-9.0.0.pre4 app/mailers/notification_mailer.rb
publify_core-9.0.0.pre3 app/mailers/notification_mailer.rb
publify_core-9.0.0.pre2 app/mailers/notification_mailer.rb
publify_core-9.0.0.pre1 app/mailers/notification_mailer.rb