Use template_name instead of action_name for notification mails
This is a new feature in rails 6
This commit is contained in:
parent
17b84d3ddd
commit
ac86c29a85
3 changed files with 6 additions and 9 deletions
|
|
@ -39,8 +39,9 @@ module NotificationMailers
|
||||||
from_name += " (#{@sender.profile.full_name.empty? ? @sender.username : @sender.name})" if @sender.present?
|
from_name += " (#{@sender.profile.full_name.empty? ? @sender.username : @sender.name})" if @sender.present?
|
||||||
|
|
||||||
{
|
{
|
||||||
from: name_and_address(from_name, AppConfig.mail.sender_address),
|
from: name_and_address(from_name, AppConfig.mail.sender_address),
|
||||||
to: name_and_address(@recipient.name, @recipient.email)
|
to: name_and_address(@recipient.name, @recipient.email),
|
||||||
|
template_name: self.class.name.demodulize.underscore
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,10 @@ class Notifier < ApplicationMailer
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_notification(type, *args)
|
def send_notification(type, *args)
|
||||||
@notification = NotificationMailers.const_get(type.to_s.camelize).new(*args)
|
@notification = NotificationMailers.const_get(type.camelize).new(*args)
|
||||||
|
|
||||||
with_recipient_locale do
|
with_recipient_locale do
|
||||||
self.action_name = type
|
mail(@notification.headers)
|
||||||
mail(@notification.headers) do |format|
|
|
||||||
format.text
|
|
||||||
format.html
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module Workers
|
||||||
sidekiq_options queue: :low
|
sidekiq_options queue: :low
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
Notifier.send_notification(self.class.name.gsub("Workers::Mail::", "").underscore, *args).deliver_now
|
Notifier.send_notification(self.class.name.demodulize.underscore, *args).deliver_now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue