donphan/app/mailers/admin_mailer.rb

58 lines
1.2 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
class AdminMailer < ApplicationMailer
layout 'plain_mailer'
helper :accounts
helper :languages
2023-07-08 19:03:38 +01:00
before_action :process_params
before_action :set_instance
default to: -> { @me.user_email }
def new_report(report)
@report = report
locale_for_account(@me) do
2023-07-08 19:03:38 +01:00
mail subject: default_i18n_subject(instance: @instance, id: @report.id)
end
end
2023-07-08 19:03:38 +01:00
def new_appeal(appeal)
@appeal = appeal
locale_for_account(@me) do
2023-07-08 19:03:38 +01:00
mail subject: default_i18n_subject(instance: @instance, username: @appeal.account.username)
end
end
2023-07-08 19:03:38 +01:00
def new_pending_account(user)
@account = user.account
locale_for_account(@me) do
2023-07-08 19:03:38 +01:00
mail subject: default_i18n_subject(instance: @instance, username: @account.username)
end
end
2023-07-08 19:03:38 +01:00
def new_trends(links, tags, statuses)
@links = links
@tags = tags
@statuses = statuses
locale_for_account(@me) do
2023-07-08 19:03:38 +01:00
mail subject: default_i18n_subject(instance: @instance)
end
end
2023-07-08 19:03:38 +01:00
private
def process_params
@me = params[:recipient]
end
def set_instance
@instance = Rails.configuration.x.local_domain
end
end