From daff1d637b95c322a059f2fa7ece742ae3dc17df Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:40:02 +0100 Subject: [PATCH] Remove old email template (#2591) --- app/models/user.rb | 7 ------- spec/features/user_spec.rb | 4 ++-- spec/mailers/resend_invitation_mailer_spec.rb | 2 +- spec/requests/organisations_controller_spec.rb | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 58e806bc5..23e787268 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -157,7 +157,6 @@ class User < ApplicationRecord RESET_PASSWORD_TEMPLATE_ID = "2c410c19-80a7-481c-a531-2bcb3264f8e6".freeze CONFIRMABLE_TEMPLATE_ID = "3fc2e3a7-0835-4b84-ab7a-ce51629eb614".freeze RECONFIRMABLE_TEMPLATE_ID = "bcdec787-f0a7-46e9-8d63-b3e0a06ee455".freeze - BETA_ONBOARDING_TEMPLATE_ID = "b48bc2cd-5887-4611-8296-d0ab3ed0e7fd".freeze USER_REACTIVATED_TEMPLATE_ID = "ac45a899-490e-4f59-ae8d-1256fc0001f9".freeze FOR_OLD_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID = "3eb80517-1051-4dfc-b4cc-cb18228a3829".freeze FOR_NEW_EMAIL_CHANGED_BY_OTHER_USER_TEMPLATE_ID = "0cdd0be1-7fa5-4808-8225-ae4c5a002352".freeze @@ -169,8 +168,6 @@ class User < ApplicationRecord def confirmable_template if last_sign_in_at.present? && (unconfirmed_email.blank? || unconfirmed_email == email) USER_REACTIVATED_TEMPLATE_ID - elsif was_migrated_from_softwire? && last_sign_in_at.blank? - BETA_ONBOARDING_TEMPLATE_ID elsif initial_confirmation_sent && !confirmed? RECONFIRMABLE_TEMPLATE_ID else @@ -178,10 +175,6 @@ class User < ApplicationRecord end end - def was_migrated_from_softwire? - legacy_users.any? || old_user_id.present? - end - def send_confirmation_instructions return unless active? diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index c30abe1e9..119dbfa52 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -600,8 +600,8 @@ RSpec.describe "User Features" do visit(user_path(other_user)) end - it "sends beta onboarding email to be sent when user is legacy" do - expect(notify_client).to receive(:send_email).with(email_address: "new_user@example.com", template_id: User::BETA_ONBOARDING_TEMPLATE_ID, personalisation:).once + it "sends initial confirmable template email when user is legacy" do + expect(notify_client).to receive(:send_email).with(email_address: "new_user@example.com", template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:).once click_button("Resend invite link") end end diff --git a/spec/mailers/resend_invitation_mailer_spec.rb b/spec/mailers/resend_invitation_mailer_spec.rb index 2b76484c3..9dec88ace 100644 --- a/spec/mailers/resend_invitation_mailer_spec.rb +++ b/spec/mailers/resend_invitation_mailer_spec.rb @@ -42,7 +42,7 @@ RSpec.describe ResendInvitationMailer do it "sends an initial invitation" do FactoryBot.create(:legacy_user, old_user_id: new_active_migrated_user.old_user_id, user: new_active_migrated_user) - expect(notify_client).to receive(:send_email).with(email_address: "new_active_migrated_user@example.com", template_id: User::BETA_ONBOARDING_TEMPLATE_ID, personalisation:).once + expect(notify_client).to receive(:send_email).with(email_address: "new_active_migrated_user@example.com", template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation:).once described_class.new.resend_invitation_email(new_active_migrated_user) end end diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index d3e8a8155..cb74ca3ab 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -1688,7 +1688,7 @@ RSpec.describe OrganisationsController, type: :request do end it "sends invitation emails" do - expect(notify_client).to have_received(:send_email).with(email_address: user_to_reactivate.email, template_id: User::BETA_ONBOARDING_TEMPLATE_ID, personalisation: expected_personalisation).once + expect(notify_client).to have_received(:send_email).with(email_address: user_to_reactivate.email, template_id: User::CONFIRMABLE_TEMPLATE_ID, personalisation: expected_personalisation).once end end end