Sha256: 5644a2c44848f3adcd2b7436732c1cb149a16224f44275accd2d124f7d3a7a82

Contents?: true

Size: 897 Bytes

Versions: 24

Compression:

Stored size: 897 Bytes

Contents

# frozen_string_literal: true

class NotificationMailer < ApplicationMailer
  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

24 entries across 24 versions & 2 rubygems

Version Path
publify_core-10.0.2 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.5.0 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.4.0 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.3.0 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.2.0 app/mailers/notification_mailer.rb
publify_core-10.0.1 app/mailers/notification_mailer.rb
publify_core-10.0.0 app/mailers/notification_mailer.rb
publify_core-9.2.10 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.1.1 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.1.0 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.0.3 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.0.2 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.0.1 app/mailers/notification_mailer.rb
HornsAndHooves-publify_core-10.0.0 app/mailers/notification_mailer.rb
publify_core-9.2.9 app/mailers/notification_mailer.rb
publify_core-9.2.8 app/mailers/notification_mailer.rb
publify_core-9.2.7 app/mailers/notification_mailer.rb
publify_core-9.2.6 app/mailers/notification_mailer.rb
publify_core-9.2.5 app/mailers/notification_mailer.rb
publify_core-9.2.4 app/mailers/notification_mailer.rb