From b669183b26bc59bba913f031a44fee0457d40532 Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis Date: Tue, 24 Mar 2026 09:58:13 +0000 Subject: [PATCH] CLDC-4280: send notify emails in real time in all environments to avoid auth/time skew errors --- app/mailers/devise_notify_mailer.rb | 20 +++++++++++++++----- app/mailers/notify_mailer.rb | 20 +++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/mailers/devise_notify_mailer.rb b/app/mailers/devise_notify_mailer.rb index 4065e3aa9..6e7b1f6fc 100644 --- a/app/mailers/devise_notify_mailer.rb +++ b/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) diff --git a/app/mailers/notify_mailer.rb b/app/mailers/notify_mailer.rb index 21a6e0270..3c19de54f 100644 --- a/app/mailers/notify_mailer.rb +++ b/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)