Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2022-07-16 20:32:46 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2022-07-20 22:26:58 +0300
commitac86c29a8559679ba444fa64b59ef0cd963ac55f (patch)
tree88d88825af5575388c33e6e083a093cee89852c6
parent17b84d3dddd2dcb9d1a0e7f203f4776f80539186 (diff)
Use template_name instead of action_name for notification mails
This is a new feature in rails 6
-rw-r--r--app/mailers/notification_mailers/base.rb5
-rw-r--r--app/mailers/notifier.rb8
-rw-r--r--app/workers/mail/notifier_base.rb2
3 files changed, 6 insertions, 9 deletions
diff --git a/app/mailers/notification_mailers/base.rb b/app/mailers/notification_mailers/base.rb
index e4f56eb4b..7b2a6135c 100644
--- a/app/mailers/notification_mailers/base.rb
+++ b/app/mailers/notification_mailers/base.rb
@@ -39,8 +39,9 @@ module NotificationMailers
from_name += " (#{@sender.profile.full_name.empty? ? @sender.username : @sender.name})" if @sender.present?
{
- from: name_and_address(from_name, AppConfig.mail.sender_address),
- to: name_and_address(@recipient.name, @recipient.email)
+ from: name_and_address(from_name, AppConfig.mail.sender_address),
+ to: name_and_address(@recipient.name, @recipient.email),
+ template_name: self.class.name.demodulize.underscore
}
end
diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb
index 35b3f9f69..a04949486 100644
--- a/app/mailers/notifier.rb
+++ b/app/mailers/notifier.rb
@@ -51,14 +51,10 @@ class Notifier < ApplicationMailer
end
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
- self.action_name = type
- mail(@notification.headers) do |format|
- format.text
- format.html
- end
+ mail(@notification.headers)
end
end
diff --git a/app/workers/mail/notifier_base.rb b/app/workers/mail/notifier_base.rb
index 8e9924a0f..d0a703280 100644
--- a/app/workers/mail/notifier_base.rb
+++ b/app/workers/mail/notifier_base.rb
@@ -6,7 +6,7 @@ module Workers
sidekiq_options queue: :low
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