admin_mailer.rb 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # frozen_string_literal: true
  2. class AdminMailer < ApplicationMailer
  3. layout 'plain_mailer'
  4. helper :accounts
  5. def new_report(recipient, report)
  6. @report = report
  7. @me = recipient
  8. @instance = Rails.configuration.x.local_domain
  9. locale_for_account(@me) do
  10. mail to: @me.user_email, subject: I18n.t('admin_mailer.new_report.subject', instance: @instance, id: @report.id)
  11. end
  12. end
  13. def new_appeal(recipient, appeal)
  14. @appeal = appeal
  15. @me = recipient
  16. @instance = Rails.configuration.x.local_domain
  17. locale_for_account(@me) do
  18. mail to: @me.user_email, subject: I18n.t('admin_mailer.new_appeal.subject', instance: @instance, username: @appeal.account.username)
  19. end
  20. end
  21. def new_pending_account(recipient, user)
  22. @account = user.account
  23. @me = recipient
  24. @instance = Rails.configuration.x.local_domain
  25. locale_for_account(@me) do
  26. mail to: @me.user_email, subject: I18n.t('admin_mailer.new_pending_account.subject', instance: @instance, username: @account.username)
  27. end
  28. end
  29. def new_trends(recipient, links, tags, statuses)
  30. @links = links
  31. @lowest_trending_link = Trends.links.query.allowed.limit(Trends.links.options[:review_threshold]).last
  32. @tags = tags
  33. @lowest_trending_tag = Trends.tags.query.allowed.limit(Trends.tags.options[:review_threshold]).last
  34. @statuses = statuses
  35. @lowest_trending_status = Trends.statuses.query.allowed.limit(Trends.statuses.options[:review_threshold]).last
  36. @me = recipient
  37. @instance = Rails.configuration.x.local_domain
  38. locale_for_account(@me) do
  39. mail to: @me.user_email, subject: I18n.t('admin_mailer.new_trends.subject', instance: @instance)
  40. end
  41. end
  42. end