Set important mailer headers with after_action
callback (#32057)
This commit is contained in:
parent
780e2e9d66
commit
19dedd7cfd
1 changed files with 10 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue