mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-17 22:42:22 +08:00
Merge pull request #6729 from artoscinote/ma_SCI_9608
Fix notification mailer [SCI-9608]
This commit is contained in:
commit
a35481adec
3 changed files with 13 additions and 20 deletions
|
|
@ -22,4 +22,16 @@ class AppMailer < Devise::Mailer
|
|||
}.merge(opts)
|
||||
mail(headers)
|
||||
end
|
||||
|
||||
def general_notification(opts = {})
|
||||
@user = params[:recipient]
|
||||
@notification = params[:record].to_notification
|
||||
|
||||
mail(
|
||||
{
|
||||
to: @user.email,
|
||||
subject: I18n.t('notifications.email_title')
|
||||
}.merge(opts)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class NotificationMailer < Devise::Mailer
|
||||
helper :application, :mailer, :input_sanitize
|
||||
include Devise::Controllers::UrlHelpers
|
||||
default template_path: 'users/mailer'
|
||||
default from: ENV.fetch('MAIL_FROM')
|
||||
default reply: ENV.fetch('MAIL_REPLYTO')
|
||||
|
||||
def general_notification
|
||||
@user = params[:recipient]
|
||||
@notification = params[:record].to_notification
|
||||
|
||||
mail(
|
||||
to: @user.email,
|
||||
subject: I18n.t('notifications.email_title')
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class BaseNotification < Noticed::Base
|
||||
deliver_by :database, if: :database_notification?
|
||||
deliver_by :email, mailer: 'NotificationMailer', method: :general_notification, if: :email_notification?
|
||||
deliver_by :email, mailer: 'AppMailer', method: :general_notification, if: :email_notification?
|
||||
|
||||
def self.send_notifications(params, later: false)
|
||||
recipients_class =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue