admin_mailer.rb 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. def new_software_updates
  36. locale_for_account(@me) do
  37. mail subject: default_i18n_subject(instance: @instance)
  38. end
  39. end
  40. def new_critical_software_updates
  41. headers['Priority'] = 'urgent'
  42. headers['X-Priority'] = '1'
  43. headers['Importance'] = 'high'
  44. locale_for_account(@me) do
  45. mail subject: default_i18n_subject(instance: @instance)
  46. end
  47. end
  48. private
  49. def process_params
  50. @me = params[:recipient]
  51. end
  52. def set_instance
  53. @instance = Rails.configuration.x.local_domain
  54. end
  55. end