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