Set important mailer headers with `after_action` callback (#32057)

pull/2856/head
Matt Jankowski 2024-09-24 09:16:31 -04:00 committed by GitHub
parent 780e2e9d66
commit 19dedd7cfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 6 deletions

View File

@ -9,6 +9,8 @@ class AdminMailer < ApplicationMailer
before_action :process_params
before_action :set_instance
after_action :set_important_headers!, only: :new_critical_software_updates
default to: -> { @me.user_email }
def new_report(report)
@ -56,12 +58,6 @@ class AdminMailer < ApplicationMailer
def new_critical_software_updates
@software_updates = SoftwareUpdate.where(urgent: true).to_a.sort_by(&:gem_version)
headers(
'Importance' => 'high',
'Priority' => 'urgent',
'X-Priority' => '1'
)
locale_for_account(@me) do
mail subject: default_i18n_subject(instance: @instance)
end
@ -82,4 +78,12 @@ class AdminMailer < ApplicationMailer
def set_instance
@instance = Rails.configuration.x.local_domain
end
def set_important_headers!
headers(
'Importance' => 'high',
'Priority' => 'urgent',
'X-Priority' => '1'
)
end
end