admin_mailer.rb 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # frozen_string_literal: true
  2. class AdminMailer < ApplicationMailer
  3. layout 'plain_mailer'
  4. helper :accounts
  5. helper :languages
  6. before_action :process_params
  7. before_action :set_instance
  8. default to: -> { @me.user_email }
  9. def new_report(report)
  10. @report = report
  11. locale_for_account(@me) do
  12. mail subject: default_i18n_subject(instance: @instance, id: @report.id)
  13. end
  14. end
  15. def new_appeal(appeal)
  16. @appeal = appeal
  17. locale_for_account(@me) do
  18. mail subject: default_i18n_subject(instance: @instance, username: @appeal.account.username)
  19. end
  20. end
  21. def new_pending_account(user)
  22. @account = user.account
  23. locale_for_account(@me) do
  24. mail subject: default_i18n_subject(instance: @instance, username: @account.username)
  25. end
  26. end
  27. def new_trends(links, tags, statuses)
  28. @links = links
  29. @tags = tags
  30. @statuses = statuses
  31. locale_for_account(@me) do
  32. mail subject: default_i18n_subject(instance: @instance)
  33. end
  34. end
  35. private
  36. def process_params
  37. @me = params[:recipient]
  38. end
  39. def set_instance
  40. @instance = Rails.configuration.x.local_domain
  41. end
  42. end