Browse Source

CLDC-4280: send notify emails in real time in all environments to avoid auth/time skew errors

pull/3262/head
Nat Dean-Lewis 1 month ago
parent
commit
b669183b26
  1. 20
      app/mailers/devise_notify_mailer.rb
  2. 20
      app/mailers/notify_mailer.rb

20
app/mailers/devise_notify_mailer.rb

@ -8,11 +8,21 @@ class DeviseNotifyMailer < Devise::Mailer
def send_email(email_address, template_id, personalisation)
return true if intercept_send?(email_address)
notify_client.send_email(
email_address:,
template_id:,
personalisation:,
)
if defined?(Timecop)
Timecop.return do
notify_client.send_email(
email_address:,
template_id:,
personalisation:,
)
end
else
notify_client.send_email(
email_address:,
template_id:,
personalisation:,
)
end
rescue Notifications::Client::BadRequestError => e
Sentry.capture_exception(e)

20
app/mailers/notify_mailer.rb

@ -8,11 +8,21 @@ class NotifyMailer < ApplicationMailer
def send_email(email, template_id, personalisation)
return true if intercept_send?(email)
notify_client.send_email(
email_address: email,
template_id:,
personalisation:,
)
if defined?(Timecop)
Timecop.return do
notify_client.send_email(
email_address: email,
template_id:,
personalisation:,
)
end
else
notify_client.send_email(
email_address: email,
template_id:,
personalisation:,
)
end
end
def personalisation(record, token, url, username: false)

Loading…
Cancel
Save