From 1726979812704975487f3826cdaee572a15be864 Mon Sep 17 00:00:00 2001 From: Caio <117518+caiosba@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:48:57 -0300 Subject: [PATCH] [WIP] Ticket CV2-5067: Fixing e-mail template --- app/mailers/export_list_mailer.rb | 3 ++- app/views/export_list_mailer/send_csv.html.erb | 8 +++++++- app/views/export_list_mailer/send_csv.text.erb | 4 +++- config/locales/en.yml | 7 ++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/mailers/export_list_mailer.rb b/app/mailers/export_list_mailer.rb index 882eff3e0..c9fed76b0 100644 --- a/app/mailers/export_list_mailer.rb +++ b/app/mailers/export_list_mailer.rb @@ -4,7 +4,8 @@ class ExportListMailer < ApplicationMailer def send_csv(csv_file_url, user) @csv_file_url = csv_file_url @user = user - @expire_in = CheckConfig.get('export_csv_expire', 7.days.to_i, :integer) / (60 * 60 * 24) + expire_in = Time.now.to_i + CheckConfig.get('export_csv_expire', 7.days.to_i, :integer) + @expire_in = I18n.l(Time.at(expire_in), format: :email) subject = I18n.t('mails_notifications.export_list.subject') Rails.logger.info "Sending export e-mail to #{@user.email}" mail(to: @user.email, email_type: 'export_list', subject: subject) diff --git a/app/views/export_list_mailer/send_csv.html.erb b/app/views/export_list_mailer/send_csv.html.erb index ec3010e3b..081169fd8 100644 --- a/app/views/export_list_mailer/send_csv.html.erb +++ b/app/views/export_list_mailer/send_csv.html.erb @@ -54,7 +54,7 @@
- <%= I18n.t(:"mails_notifications.export_list.body", days: @expire_in) %> + <%= I18n.t(:"mails_notifications.export_list.body") %>
@@ -100,6 +100,12 @@   + +
+
+ <%= I18n.t(:"mails_notifications.export_list.footer", date: @expire_in) %> +
+
diff --git a/app/views/export_list_mailer/send_csv.text.erb b/app/views/export_list_mailer/send_csv.text.erb index 309fb33d6..428c63914 100644 --- a/app/views/export_list_mailer/send_csv.text.erb +++ b/app/views/export_list_mailer/send_csv.text.erb @@ -2,10 +2,12 @@ <%= I18n.t('mails_notifications.export_list.subject') %> -<%= I18n.t('mails_notifications.export_list.body', days: @expire_in ) %> +<%= I18n.t('mails_notifications.export_list.body') %> <%= I18n.t('mails_notifications.export_list.button_label') %>: <%= @csv_file_url %> +<%= I18n.t('mails_notifications.export_list.footer', date: @expire_in ) %> + ... <%= strip_tags I18n.t("mails_notifications.copyright_html", app_name: CheckConfig.get('app_name')) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 76c56b886..e947f62ab 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -477,10 +477,11 @@ en: term_button: Terms of Service more_info: This is a one-time required legal notice sent to all Check users, even those who have unsubscribed by optional announcements. export_list: - subject: Your Check data export is ready hello: Hello %{name} - body: Your data export is ready. Click on the button below to download it. Please note that the link is valid only for %{days} days. - button_label: Download export + subject: Check Data Export + body: Your requested Check data export is available to download. + button_label: Download Export + footer: This download link will expire on %{date}. mail_security: device_subject: 'Security alert: New login to %{app_name} from %{browser} on %{platform}' ip_subject: 'Security alert: New or unusual %{app_name} login'