From ebaaa438dfc19222ca1ee81358b55ed13195cc2a Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Wed, 28 Aug 2024 10:30:15 +0200 Subject: [PATCH 1/7] More updates --- app/views/devise/confirmations/edit.html.haml | 2 +- app/views/layouts/mailer.html.haml | 2 +- config/locales/mailings.en.yml | 2 +- config/locales/mailings.nl.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/devise/confirmations/edit.html.haml b/app/views/devise/confirmations/edit.html.haml index 3586149aa..4e6556468 100644 --- a/app/views/devise/confirmations/edit.html.haml +++ b/app/views/devise/confirmations/edit.html.haml @@ -18,7 +18,7 @@ = flash[:notice] %fieldset - %h4{:style => "color:white;"} + %h4.dark:text-white = I18n.t :activate, scope: 'devise.confirmations' .form-group diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index a2d8f91ba..9f0d43c43 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -60,7 +60,7 @@ .content{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;"} %table.main{:bgcolor => "#fff", :cellpadding => "0", :cellspacing => "0", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background-color: #fff; margin: 0; border: 1px solid #e9e9e9;", :width => "100%"} %tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"} - %td.alert.alert-warning{:align => "center", :bgcolor => "#197052", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background-color: #197052; margin: 0; padding: 20px;", :valign => "top"} + %td.alert.alert-warning{:align => "center", :bgcolor => "#61518f", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background-color: #61518f; margin: 0; padding: 20px;", :valign => "top"} = I18n.t('association_name') %tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"} diff --git a/config/locales/mailings.en.yml b/config/locales/mailings.en.yml index 0d3e481c1..35e7b0c03 100644 --- a/config/locales/mailings.en.yml +++ b/config/locales/mailings.en.yml @@ -14,7 +14,7 @@ en: account_activation_instructions: Activate your account by clicking the button below account_activation_link: Activate your account for our member system by going to %{url}. activate_account: Activate account - activity_updates_html: 'Do you always want to stay informed about these activities? Follow our %{instagram_page_link_start} Sticky-members Instagram %{link_end} and follow our %{linkedin_page_link_start} our page %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!' + activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our WhatsApp promotion channel to be notified about upcoming activities!' and_now: And now? corner_stones: business: diff --git a/config/locales/mailings.nl.yml b/config/locales/mailings.nl.yml index 021977bdf..a41580eda 100644 --- a/config/locales/mailings.nl.yml +++ b/config/locales/mailings.nl.yml @@ -14,7 +14,7 @@ nl: account_activation_instructions: 'Activeer je account door op onderstaande knop te klikken:' account_activation_link: Activeer je account voor ons ledenbeheersysteem door naar %{url} te gaan. activate_account: Activeer account - activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en volg ons op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!' + activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze WhatsApp community om altijd op de hoogte gehouden te worden van aankomende activiteiten!' and_now: En nu? corner_stones: business: From 7cb1df54baadd003fc73cf7c2daee86ed28da154 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Sun, 1 Sep 2024 11:12:49 +0200 Subject: [PATCH 2/7] Fix: Incorrect activation URL Fix: Hide 'Are you not %{name}' if there is no name Debug: Print activation email during development (as there is no way to send emails) Fix: Text colouring issues all over the place in authorization pages Fix: WhatsApp promo URL is properly localised and escaped now. --- app/controllers/users/confirmations_controller.rb | 2 +- app/mailers/application_mailer.rb | 6 ++++-- app/mailers/mailings/devise.rb | 10 ++++++---- app/views/devise/confirmations/edit.html.haml | 4 ++-- app/views/devise/confirmations/new.html.haml | 2 +- app/views/devise/confirmations/show.html.haml | 4 ++-- app/views/layouts/doorkeeper.html.haml | 4 ++-- .../mailings/devise/activation_instructions.html.haml | 10 ++++++---- config/locales/mailings.en.yml | 2 +- config/locales/mailings.nl.yml | 2 +- 10 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 226f46c5a..3e8f55dea 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -30,7 +30,7 @@ def create end # require valid password to confirm email - unless user.valid_password?(confirmation_params[:password]) + unless user.valid_password?(confirmation_params[:password].to_s) flash[:alert] = I18n.t('devise.failure.invalid_password') redirect_to(user_confirmation_path(confirmation_token: confirmation_params[:confirmation_token])) return diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 611e7f9ce..4ac770325 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -28,7 +28,8 @@ def mail(recipient, sender, subject, html, text, attachment = nil) raise(ArgumentError) if html.blank? && text.blank? if ENV['MAILGUN_DOMAIN'].blank? || ENV['MAILGUN_TOKEN'].blank? - Rails.logger.error("mailgun credentials not send, cannot send email") + Rails.logger.error("mailgun credentials not set, cannot send email. Printing email instead.") + Rails.logger.info(html) return end @@ -47,7 +48,8 @@ def mails(recipient, sender, subject, html, text, attachment = nil) raise(ArgumentError) if (html.blank? && text.blank?) || recipient.blank? if ENV['MAILGUN_DOMAIN'].blank? || ENV['MAILGUN_TOKEN'].blank? - Rails.logger.debug("mailgun credentials not send, cannot send email") + Rails.logger.debug("mailgun credentials not set, cannot send email. Printing email instead.") + Rails.logger.info(html) return end diff --git a/app/mailers/mailings/devise.rb b/app/mailers/mailings/devise.rb index 2a77d8e80..828590837 100644 --- a/app/mailers/mailings/devise.rb +++ b/app/mailers/mailings/devise.rb @@ -5,18 +5,19 @@ class Devise < ApplicationMailer include ::Devise::Controllers::UrlHelpers def confirmation_instructions(record, token, _opts = {}) - Rails.logger.debug(confirmation_url(record, confirmation_token: token)) if Rails.env.development? + url = new_member_confirmation_url(confirmation_token: token) + Rails.logger.debug(url) if Rails.env.development? html = render_to_string(locals: { name: record.credentials.name, - confirmation_url: confirmation_url(record, confirmation_token: token), + confirmation_url: url, subject: "#{ I18n.t('association_name') } | #{ I18n.t('mailings.devise.confirmation_instructions.confirm_email') }" }) text = <<~PLAINTEXT #{ I18n.t('mailings.greeting') } #{ record.credentials.name }, - #{ I18n.t('mailings.devise.confirmation_instructions.link_instructions', confirm_link: confirmation_url(record, confirmation_token: token)) } + #{ I18n.t('mailings.devise.confirmation_instructions.link_instructions', confirm_link: url) } #{ I18n.t('mailings.best_regards') } @@ -49,7 +50,8 @@ def activation_instructions(record, token, _opts = {}) instagram_page_link_start: ''.html_safe, linkedin_page_link_start: ''.html_safe, sticky_site_link_start: ''.html_safe, - whatsapp_promo_link_start: ''.html_safe, + whatsapp_promo_link_start_nl: ''.html_safe, + whatsapp_promo_link_start_en: ''.html_safe, link_end: ''.html_safe) } ## #{ I18n.t('mailings.devise.activation_instructions.corner_stones.education.name') } diff --git a/app/views/devise/confirmations/edit.html.haml b/app/views/devise/confirmations/edit.html.haml index 4e6556468..ffaf20694 100644 --- a/app/views/devise/confirmations/edit.html.haml +++ b/app/views/devise/confirmations/edit.html.haml @@ -9,7 +9,7 @@ - if flash[:alert] .alert.alert-danger - %span + %span.dark:text-white = flash[:alert] - if flash[:notice] @@ -48,7 +48,7 @@ -# i18n todo .row - .text-center + .text-center.dark:text-white = link_to (I18n.t 'devise.registrations.password_recovery'), new_user_password_path | = link_to (I18n.t 'devise.registrations.login'), new_user_session_path diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 1b612c737..c14ed858d 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -18,7 +18,7 @@ = flash[:notice] %fieldset - %h4= I18n.t 'devise.confirmations.new.instruction' + %h4.dark:text-white= I18n.t 'devise.confirmations.new.instruction' .form-group .input-group-prepend diff --git a/app/views/devise/confirmations/show.html.haml b/app/views/devise/confirmations/show.html.haml index 4374005b0..1a07f2ba5 100644 --- a/app/views/devise/confirmations/show.html.haml +++ b/app/views/devise/confirmations/show.html.haml @@ -18,7 +18,7 @@ = flash[:notice] %fieldset - %h4= I18n.t 'devise.confirmations.new.instruction' + %h4.dark:text-white= I18n.t 'devise.confirmations.new.instruction' .form-group .input-group @@ -39,7 +39,7 @@ = f.submit t('devise.confirmations.new.submit'), :class => 'btn btn-primary btn-block' .row - .text-center + .text-center.dark:text-white = link_to (I18n.t 'devise.registrations.login'), new_user_session_path | = link_to (I18n.t 'devise.registrations.sign_up'), new_registration_path diff --git a/app/views/layouts/doorkeeper.html.haml b/app/views/layouts/doorkeeper.html.haml index e34707538..318f4ebd0 100644 --- a/app/views/layouts/doorkeeper.html.haml +++ b/app/views/layouts/doorkeeper.html.haml @@ -23,8 +23,8 @@ .shadow.px-10.py-4.rounded-md.bg-white.mx-auto.dark:bg-gray-800.dark - - if current_user.present? - %h2.mt-2 + - if current_user.present? and current_user.credentials.first_name? + %h2.mt-2.dark:text-white = I18n.t('layouts.doorkeeper.hi') %b= current_user.credentials.first_name = I18n.t('layouts.doorkeeper.identity_confirmation', name: current_user.credentials.name) diff --git a/app/views/mailings/devise/activation_instructions.html.haml b/app/views/mailings/devise/activation_instructions.html.haml index 9e3c0a52b..735bc315d 100644 --- a/app/views/mailings/devise/activation_instructions.html.haml +++ b/app/views/mailings/devise/activation_instructions.html.haml @@ -16,10 +16,12 @@ = t('mailings.devise.activation_instructions.about_sticky') = t('mailings.devise.activation_instructions.activity_updates_html', - facebook_group_link_start: raw(""), - facebook_page_link_start: raw(""), - sticky_site_link_start: raw(""), - link_end: raw("")) + instagram_page_link_start: ''.html_safe, + linkedin_page_link_start: ''.html_safe, + sticky_site_link_start: ''.html_safe, + whatsapp_promo_link_start_nl: ''.html_safe, + whatsapp_promo_link_start_en: ''.html_safe, + link_end: ''.html_safe) %tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"} %td.content-block{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;", :valign => "top"} diff --git a/config/locales/mailings.en.yml b/config/locales/mailings.en.yml index 35e7b0c03..1cb9eeb50 100644 --- a/config/locales/mailings.en.yml +++ b/config/locales/mailings.en.yml @@ -14,7 +14,7 @@ en: account_activation_instructions: Activate your account by clicking the button below account_activation_link: Activate your account for our member system by going to %{url}. activate_account: Activate account - activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our WhatsApp promotion channel to be notified about upcoming activities!' + activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start_en} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!' and_now: And now? corner_stones: business: diff --git a/config/locales/mailings.nl.yml b/config/locales/mailings.nl.yml index a41580eda..b0b0026e5 100644 --- a/config/locales/mailings.nl.yml +++ b/config/locales/mailings.nl.yml @@ -14,7 +14,7 @@ nl: account_activation_instructions: 'Activeer je account door op onderstaande knop te klikken:' account_activation_link: Activeer je account voor ons ledenbeheersysteem door naar %{url} te gaan. activate_account: Activeer account - activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze WhatsApp community om altijd op de hoogte gehouden te worden van aankomende activiteiten!' + activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start_nl} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!' and_now: En nu? corner_stones: business: From b8d11616fb655d5dc05b13a2e47f1dc1bebb2363 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Sun, 1 Sep 2024 15:26:34 +0200 Subject: [PATCH 3/7] Fix various things --- app/mailers/mailings/devise.rb | 39 +++++++++++++------ .../devise/activation_instructions.html.haml | 9 +++-- config/locales/mailings.en.yml | 4 +- config/locales/mailings.nl.yml | 4 +- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/app/mailers/mailings/devise.rb b/app/mailers/mailings/devise.rb index 828590837..775d5bfd9 100644 --- a/app/mailers/mailings/devise.rb +++ b/app/mailers/mailings/devise.rb @@ -5,7 +5,7 @@ class Devise < ApplicationMailer include ::Devise::Controllers::UrlHelpers def confirmation_instructions(record, token, _opts = {}) - url = new_member_confirmation_url(confirmation_token: token) + url = new_member_confirmation_url(record, confirmation_token: token) Rails.logger.debug(url) if Rails.env.development? html = render_to_string(locals: { @@ -24,7 +24,7 @@ def confirmation_instructions(record, token, _opts = {}) #{ I18n.t('mailings.signature') } PLAINTEXT - return mail(record.unconfirmed_email ||= record.email, nil, I18n.t('mailings.devise.confirmation_instructions.activate_account'), html, text) + mail(record.unconfirmed_email ||= record.email, nil, I18n.t('mailings.devise.confirmation_instructions.activate_account'), html, text) end def activation_instructions(record, token, _opts = {}) @@ -34,7 +34,8 @@ def activation_instructions(record, token, _opts = {}) html = render_to_string(locals: { name: record.credentials.first_name, activation_url: url, - subject: "#{ I18n.t('mailings.devise.activation_instructions.welcome') } | #{ I18n.t('mailings.devise.confirmation_instructions.activate_account') }" + subject: "#{ I18n.t('mailings.devise.activation_instructions.welcome') } | #{ I18n.t('mailings.devise.confirmation_instructions.activate_account') }", + whatsapp_promo_link: whatsapp_promo_link }) text = <<~MARKDOWN @@ -50,8 +51,9 @@ def activation_instructions(record, token, _opts = {}) instagram_page_link_start: ''.html_safe, linkedin_page_link_start: ''.html_safe, sticky_site_link_start: ''.html_safe, - whatsapp_promo_link_start_nl: ''.html_safe, - whatsapp_promo_link_start_en: ''.html_safe, + # rubocop:disable Rails/OutputSafety + whatsapp_promo_link_start: "".html_safe, + # rubocop:enable Rails/OutputSafety link_end: ''.html_safe) } ## #{ I18n.t('mailings.devise.activation_instructions.corner_stones.education.name') } @@ -68,12 +70,14 @@ def activation_instructions(record, token, _opts = {}) #{ I18n.t('mailings.devise.activation_instructions.corner_stones.sociability.description') } ## #{ I18n.t('mailings.devise.activation_instructions.and_now', url: url) } - #{ I18n.t('mailings.devise.activation_instructions.wrap_up', - #{' '} - url: url, - #{' '} - koala_link_start: ''.html_safe, - link_end: ''.html_safe) } + #{ I18n.t( + 'mailings.devise.activation_instructions.wrap_up_html', + #{' '} + url: url, + #{' '} + koala_link_start: ''.html_safe, + link_end: ''.html_safe + ) } #{ I18n.t('mailings.devise.activation_instructions.account_activation_link', url: url) } @@ -82,7 +86,18 @@ def activation_instructions(record, token, _opts = {}) #{ I18n.t('mailings.signature') } MARKDOWN - return mail(record.email, nil, "#{ I18n.t('mailings.devise.activation_instructions.welcome') } | #{ I18n.t('mailings.devise.confirmation_instructions.activate_account') }", html, text) + mail(record.email, nil, "#{ I18n.t('mailings.devise.activation_instructions.welcome') } | #{ I18n.t('mailings.devise.confirmation_instructions.activate_account') }", html, text) + end + + private + + def whatsapp_promo_link + if I18n.locale == :en + "https://svsticky.nl/promochannel" + else + # Fallback is NL + "https://svsticky.nl/promokanaal" + end end def reset_password_instructions(record, token, _opts = {}) diff --git a/app/views/mailings/devise/activation_instructions.html.haml b/app/views/mailings/devise/activation_instructions.html.haml index 735bc315d..c26dcd3d8 100644 --- a/app/views/mailings/devise/activation_instructions.html.haml +++ b/app/views/mailings/devise/activation_instructions.html.haml @@ -19,8 +19,7 @@ instagram_page_link_start: ''.html_safe, linkedin_page_link_start: ''.html_safe, sticky_site_link_start: ''.html_safe, - whatsapp_promo_link_start_nl: ''.html_safe, - whatsapp_promo_link_start_en: ''.html_safe, + whatsapp_promo_link_start: "".html_safe, link_end: ''.html_safe) %tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"} @@ -34,7 +33,7 @@ %h2 = t('mailings.devise.activation_instructions.corner_stones.business.name') = t('mailings.devise.activation_instructions.corner_stones.business.description_html', - job_offer_page_link_start: raw(''), + job_offer_page_link_start: raw(''), link_end: raw("")) %h2 @@ -43,7 +42,9 @@ %h2 = t('mailings.devise.activation_instructions.and_now') - = t('mailings.devise.activation_instructions.wrap_up') + = t('mailings.devise.activation_instructions.wrap_up_html', + koala_link_start: raw(''), + link_end: raw('')) = t('mailings.devise.activation_instructions.account_activation_instructions') %tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"} diff --git a/config/locales/mailings.en.yml b/config/locales/mailings.en.yml index 1cb9eeb50..175b29897 100644 --- a/config/locales/mailings.en.yml +++ b/config/locales/mailings.en.yml @@ -14,7 +14,7 @@ en: account_activation_instructions: Activate your account by clicking the button below account_activation_link: Activate your account for our member system by going to %{url}. activate_account: Activate account - activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start_en} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!' + activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!' and_now: And now? corner_stones: business: @@ -29,7 +29,7 @@ en: reception_justification: You are receiving this e-mail, because you signed up for our mighty beautiful study association! At the end of this mail you will find a button to activate your account in our members portal. You could also skip this gorgeous introduction talk en scroll down immediately. We won't see that anyway (or will we?). see_you_soon: See you soon! welcome: Welcome to Sticky! - wrap_up: Curious about which activities we will soon organize? You can find more information in our member portal, %{koala_link_start} Koala%{link_end}, and you can enroll there too! In this member portal you can also edit your profile. + wrap_up_html: 'Curious about which activities we will soon organize? You can find more information in our member portal, %{koala_link_start} Koala%{link_end}, and you can enroll there too! In this member portal you can also edit your profile.' changed_instructions: changed_email: Emailaddress changed inform_change_text: Your emailaddress is changed to %{new_email}. Please contact us as soon as possible (by replying to this email) if this change was not done by you. diff --git a/config/locales/mailings.nl.yml b/config/locales/mailings.nl.yml index b0b0026e5..ee946ced4 100644 --- a/config/locales/mailings.nl.yml +++ b/config/locales/mailings.nl.yml @@ -14,7 +14,7 @@ nl: account_activation_instructions: 'Activeer je account door op onderstaande knop te klikken:' account_activation_link: Activeer je account voor ons ledenbeheersysteem door naar %{url} te gaan. activate_account: Activeer account - activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start_nl} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!' + activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!' and_now: En nu? corner_stones: business: @@ -29,7 +29,7 @@ nl: reception_justification: Je ontvangt deze mail omdat je je hebt aangemeld voor onze machtig mooie studievereniging! Aan het eind van deze mail vind je de knop om je account in ons ledenportaal te activeren. Je kunt ook dit prachtige introductiepraatje overslaan en meteen naar beneden scrollen, dat zien we toch niet (of toch wel?). see_you_soon: Tot snel! welcome: Welkom bij Sticky! - wrap_up: Nieuwsgierig naar welke activiteiten we binnenkort organiseren? Meer informatie vind je in ons ledenportaal, %{koala_link_start} Koala%{link_end}, en je kunt je daar ook meteen inschrijven! Daarnaast kun je in dit ledenportaal ook je gegevens aanpassen. + wrap_up_html: 'Nieuwsgierig naar welke activiteiten we binnenkort organiseren? Meer informatie vind je in ons ledenportaal, %{koala_link_start} Koala%{link_end}, en je kunt je daar ook meteen inschrijven! Daarnaast kun je in dit ledenportaal ook je gegevens aanpassen.' changed_instructions: changed_email: E-mailadres gewijzigd inform_change_text: Je e-mailadres is gewijzigd naar %{new_email}. Neem zo snel mogelijk contact op (door te antwoorden op deze mail) als je deze wijziging niet hebt aangevraagd. From dd90202e74f2cbe69595d39a67883fbeabcc81c9 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Sun, 1 Sep 2024 19:26:38 +0200 Subject: [PATCH 4/7] Fix comments; 'Fix'-ish occasionally broken activation mails --- app/mailers/mailings/devise.rb | 12 +++++++++++- config/locales/mailings.en.yml | 2 +- config/locales/mailings.nl.yml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/mailers/mailings/devise.rb b/app/mailers/mailings/devise.rb index 775d5bfd9..434b60d69 100644 --- a/app/mailers/mailings/devise.rb +++ b/app/mailers/mailings/devise.rb @@ -5,7 +5,12 @@ class Devise < ApplicationMailer include ::Devise::Controllers::UrlHelpers def confirmation_instructions(record, token, _opts = {}) - url = new_member_confirmation_url(record, confirmation_token: token) + Rails.logger.debug("Sending confirmation instructions") + + url = confirmation_url(record, confirmation_token: token) + # FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why + url = url.sub("activation", "activate") + Rails.logger.debug(url) if Rails.env.development? html = render_to_string(locals: { @@ -28,7 +33,12 @@ def confirmation_instructions(record, token, _opts = {}) end def activation_instructions(record, token, _opts = {}) + Rails.logger.debug("Sending activation instructions"); + url = new_member_confirmation_url(confirmation_token: token) + # FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why + url = url.sub("confirmation", "activate") + Rails.logger.debug(url) if Rails.env.development? html = render_to_string(locals: { diff --git a/config/locales/mailings.en.yml b/config/locales/mailings.en.yml index 175b29897..bb796d234 100644 --- a/config/locales/mailings.en.yml +++ b/config/locales/mailings.en.yml @@ -14,7 +14,7 @@ en: account_activation_instructions: Activate your account by clicking the button below account_activation_link: Activate your account for our member system by going to %{url}. activate_account: Activate account - activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!' + activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram%{link_end} and on %{linkedin_page_link_start} LinkedId%{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl%{link_end}. You can also join our %{whatsapp_promo_link_start} WhatsApp promotion channel%{link_end} to be notified about upcoming activities!' and_now: And now? corner_stones: business: diff --git a/config/locales/mailings.nl.yml b/config/locales/mailings.nl.yml index ee946ced4..ce195476e 100644 --- a/config/locales/mailings.nl.yml +++ b/config/locales/mailings.nl.yml @@ -14,7 +14,7 @@ nl: account_activation_instructions: 'Activeer je account door op onderstaande knop te klikken:' account_activation_link: Activeer je account voor ons ledenbeheersysteem door naar %{url} te gaan. activate_account: Activeer account - activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!' + activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram%{link_end} en op %{linkedin_page_link_start} LinkedIn%{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl%{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start} WhatsApp community%{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!' and_now: En nu? corner_stones: business: From 8440c7cadc85cc00fe4f0489e6bc8da89918379f Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Sun, 1 Sep 2024 19:30:39 +0200 Subject: [PATCH 5/7] Fix wrong substition --- app/mailers/mailings/devise.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mailers/mailings/devise.rb b/app/mailers/mailings/devise.rb index 434b60d69..cce2bbac6 100644 --- a/app/mailers/mailings/devise.rb +++ b/app/mailers/mailings/devise.rb @@ -9,7 +9,7 @@ def confirmation_instructions(record, token, _opts = {}) url = confirmation_url(record, confirmation_token: token) # FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why - url = url.sub("activation", "activate") + url = url.sub("/activate", "/confirmation") Rails.logger.debug(url) if Rails.env.development? @@ -37,7 +37,7 @@ def activation_instructions(record, token, _opts = {}) url = new_member_confirmation_url(confirmation_token: token) # FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why - url = url.sub("confirmation", "activate") + url = url.sub("/confirmation", "/activate") Rails.logger.debug(url) if Rails.env.development? From 3822525ffc075869f7d2c04562f71eed0e8d7da8 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Mon, 2 Sep 2024 23:06:10 +0200 Subject: [PATCH 6/7] Improve debug logging --- app/mailers/mailings/devise.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/mailers/mailings/devise.rb b/app/mailers/mailings/devise.rb index cce2bbac6..3e2e6cca6 100644 --- a/app/mailers/mailings/devise.rb +++ b/app/mailers/mailings/devise.rb @@ -5,13 +5,13 @@ class Devise < ApplicationMailer include ::Devise::Controllers::UrlHelpers def confirmation_instructions(record, token, _opts = {}) - Rails.logger.debug("Sending confirmation instructions") - url = confirmation_url(record, confirmation_token: token) # FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why url = url.sub("/activate", "/confirmation") - Rails.logger.debug(url) if Rails.env.development? + if Rails.env.development? + Rails.logger.debug { "Sending confirmation instructions to #{ record.credentials.name } <#{ record.unconfirmed_email }> with activation URL #{ url }" } + end html = render_to_string(locals: { name: record.credentials.name, @@ -33,13 +33,13 @@ def confirmation_instructions(record, token, _opts = {}) end def activation_instructions(record, token, _opts = {}) - Rails.logger.debug("Sending activation instructions"); - url = new_member_confirmation_url(confirmation_token: token) # FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why url = url.sub("/confirmation", "/activate") - Rails.logger.debug(url) if Rails.env.development? + if Rails.env.development? + Rails.logger.debug { "Sending activation instructions to #{ record.credentials.name } <#{ record.email }> with activation URL #{ url }" } + end html = render_to_string(locals: { name: record.credentials.first_name, From b3674fc41bbce1413c047658024faa2148c2fc44 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Mon, 2 Sep 2024 23:12:17 +0200 Subject: [PATCH 7/7] Normalize localisations --- config/locales/mailings.en.yml | 2 +- config/locales/mailings.nl.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/mailings.en.yml b/config/locales/mailings.en.yml index bb796d234..c3a867880 100644 --- a/config/locales/mailings.en.yml +++ b/config/locales/mailings.en.yml @@ -29,7 +29,7 @@ en: reception_justification: You are receiving this e-mail, because you signed up for our mighty beautiful study association! At the end of this mail you will find a button to activate your account in our members portal. You could also skip this gorgeous introduction talk en scroll down immediately. We won't see that anyway (or will we?). see_you_soon: See you soon! welcome: Welcome to Sticky! - wrap_up_html: 'Curious about which activities we will soon organize? You can find more information in our member portal, %{koala_link_start} Koala%{link_end}, and you can enroll there too! In this member portal you can also edit your profile.' + wrap_up_html: Curious about which activities we will soon organize? You can find more information in our member portal, %{koala_link_start} Koala%{link_end}, and you can enroll there too! In this member portal you can also edit your profile. changed_instructions: changed_email: Emailaddress changed inform_change_text: Your emailaddress is changed to %{new_email}. Please contact us as soon as possible (by replying to this email) if this change was not done by you. diff --git a/config/locales/mailings.nl.yml b/config/locales/mailings.nl.yml index ce195476e..921dc49c1 100644 --- a/config/locales/mailings.nl.yml +++ b/config/locales/mailings.nl.yml @@ -29,7 +29,7 @@ nl: reception_justification: Je ontvangt deze mail omdat je je hebt aangemeld voor onze machtig mooie studievereniging! Aan het eind van deze mail vind je de knop om je account in ons ledenportaal te activeren. Je kunt ook dit prachtige introductiepraatje overslaan en meteen naar beneden scrollen, dat zien we toch niet (of toch wel?). see_you_soon: Tot snel! welcome: Welkom bij Sticky! - wrap_up_html: 'Nieuwsgierig naar welke activiteiten we binnenkort organiseren? Meer informatie vind je in ons ledenportaal, %{koala_link_start} Koala%{link_end}, en je kunt je daar ook meteen inschrijven! Daarnaast kun je in dit ledenportaal ook je gegevens aanpassen.' + wrap_up_html: Nieuwsgierig naar welke activiteiten we binnenkort organiseren? Meer informatie vind je in ons ledenportaal, %{koala_link_start} Koala%{link_end}, en je kunt je daar ook meteen inschrijven! Daarnaast kun je in dit ledenportaal ook je gegevens aanpassen. changed_instructions: changed_email: E-mailadres gewijzigd inform_change_text: Je e-mailadres is gewijzigd naar %{new_email}. Neem zo snel mogelijk contact op (door te antwoorden op deze mail) als je deze wijziging niet hebt aangevraagd.