From d246dd41f2208d379cda787c72d4f6309abec132 Mon Sep 17 00:00:00 2001 From: Lori Bailey <44073106+elceebee@users.noreply.github.com> Date: Mon, 20 Jan 2025 15:02:13 +0000 Subject: [PATCH] Revert One Login pre-release email This reverts commit 13c48770ebedcc90037961bbb829abd427d76f6c, reversing changes made to 4baeb044fb039231d1c849f6fb3bb1f2d119e624. --- app/mailers/candidate_mailer.rb | 9 ---- .../one_login_is_coming.text.erb | 19 --------- ...didate_one_login_is_coming_email_worker.rb | 36 ---------------- config/clock.rb | 1 - config/locales/emails/candidate_mailer.yml | 2 - .../previews/candidate_mailer_preview.rb | 5 --- spec/system/support_interface/docs_spec.rb | 1 - ...e_one_login_is_coming_email_worker_spec.rb | 42 ------------------- ...login_is_coming_email_batch_worker_spec.rb | 12 ------ 9 files changed, 127 deletions(-) delete mode 100644 app/views/candidate_mailer/one_login_is_coming.text.erb delete mode 100644 app/workers/send_candidate_one_login_is_coming_email_worker.rb delete mode 100644 spec/workers/send_candidate_one_login_is_coming_email_worker_spec.rb delete mode 100644 spec/workers/send_one_login_is_coming_email_batch_worker_spec.rb diff --git a/app/mailers/candidate_mailer.rb b/app/mailers/candidate_mailer.rb index 7ad1e8f958f..dd4d003d898 100644 --- a/app/mailers/candidate_mailer.rb +++ b/app/mailers/candidate_mailer.rb @@ -513,15 +513,6 @@ def apply_to_multiple_courses_after_30_working_days(application_form) ) end - def one_login_is_coming(application_form) - @application_form = application_form - - email_for_candidate( - @application_form, - subject: I18n.t!('candidate_mailer.one_login_is_coming.subject'), - ) - end - def one_login_has_arrived(application_form) @application_form = application_form diff --git a/app/views/candidate_mailer/one_login_is_coming.text.erb b/app/views/candidate_mailer/one_login_is_coming.text.erb deleted file mode 100644 index 12bfad309b5..00000000000 --- a/app/views/candidate_mailer/one_login_is_coming.text.erb +++ /dev/null @@ -1,19 +0,0 @@ -<% if @application_form.first_name.present? %> - Hello <%= @application_form.first_name %>, -<% end %> - -# How you sign in to Apply for teacher training is changing - -During the week of 27 January, users will begin signing in using GOV.UK One Login. You'll be able to create a GOV.UK One Login if you do not already have one. - -You should use the same email address to create your GOV.UK One Login that you use to sign in to Apply for teacher training. This is so you keep the existing information in your account. - -If you use a different email address you’ll be able to transfer your account details after you sign in. - -# What is GOV.UK One Login? - -GOV.UK One Login allows you to sign in to some government services using the same email address and password. - -In the future you’ll be able to use your GOV.UK One Login to access all services on GOV.UK. - -<%= render 'unsubscribe_from_emails_like_this' %> diff --git a/app/workers/send_candidate_one_login_is_coming_email_worker.rb b/app/workers/send_candidate_one_login_is_coming_email_worker.rb deleted file mode 100644 index ba52438f3b6..00000000000 --- a/app/workers/send_candidate_one_login_is_coming_email_worker.rb +++ /dev/null @@ -1,36 +0,0 @@ -class SendCandidateOneLoginIsComingEmailWorker - include Sidekiq::Worker - - def perform - return if should_not_perform? - - BatchDelivery.new(relation:, batch_size: 200).each do |batch_time, application_forms| - SendOneLoginIsComingEmailBatchWorker.perform_at(batch_time, application_forms.pluck(:id)) - end - end - - def relation - ApplicationForm - .current_cycle - .joins(:candidate) - .merge(Candidate.for_marketing_or_nudge_emails) - .has_not_received_email('candidate_mailer', 'one_login_is_coming') - .distinct - end - -private - - def should_not_perform? - FeatureFlag.active?(:one_login_candidate_sign_in) || OneLogin.bypass? - end -end - -class SendOneLoginIsComingEmailBatchWorker - include Sidekiq::Worker - - def perform(application_form_ids) - ApplicationForm.where(id: application_form_ids).find_each do |application_form| - CandidateMailer.one_login_is_coming(application_form).deliver_later - end - end -end diff --git a/config/clock.rb b/config/clock.rb index ad6a99c8897..29a9a426e64 100644 --- a/config/clock.rb +++ b/config/clock.rb @@ -51,7 +51,6 @@ class Clock every(1.day, 'SendApplyToAnotherCourseWhenInactiveEmailToCandidatesWorker', at: '10:00') { SendApplyToAnotherCourseWhenInactiveEmailToCandidatesWorker.perform_async } every(1.day, 'SendApplyToMultipleCoursesWhenInactiveEmailToCandidatesWorker', at: '10:00') { SendApplyToMultipleCoursesWhenInactiveEmailToCandidatesWorker.perform_async } every(1.day, 'DfE::Analytics::EntityTableCheckJob', at: '00:30') { DfE::Analytics::EntityTableCheckJob.perform_later } - every(1.day, 'SendCandidateOneLoginIsComingEmailWorker', at: '00:31') { SendCandidateOneLoginIsComingEmailWorker.perform_async } every(1.day, 'SendCandidateOneLoginHasArrivedEmailWorker', at: '00:05') { SendCandidateOneLoginHasArrivedEmailWorker.perform_async } # End of cycle application choice status jobs diff --git a/config/locales/emails/candidate_mailer.yml b/config/locales/emails/candidate_mailer.yml index d38c695445f..663b0d63f70 100644 --- a/config/locales/emails/candidate_mailer.yml +++ b/config/locales/emails/candidate_mailer.yml @@ -95,7 +95,5 @@ en: subject: Get help with your personal statement apply_to_course_after_inactivity: subject: Increase your chances of receiving an offer for teacher training - one_login_is_coming: - subject: How you sign in to Apply for teacher training is changing one_login_has_arrived: subject: How you sign in to Apply for teacher training has changed diff --git a/spec/mailers/previews/candidate_mailer_preview.rb b/spec/mailers/previews/candidate_mailer_preview.rb index fe18e4b3083..8fbc00fd948 100644 --- a/spec/mailers/previews/candidate_mailer_preview.rb +++ b/spec/mailers/previews/candidate_mailer_preview.rb @@ -549,11 +549,6 @@ def apply_to_multiple_courses_after_30_working_days CandidateMailer.apply_to_multiple_courses_after_30_working_days(application_form) end - def one_login_is_coming - application_form = FactoryBot.build(:application_form, first_name: 'Bob') - CandidateMailer.one_login_is_coming(application_form) - end - def one_login_has_arrived application_form = FactoryBot.build(:application_form, first_name: 'Rocket the dog') CandidateMailer.one_login_has_arrived(application_form) diff --git a/spec/system/support_interface/docs_spec.rb b/spec/system/support_interface/docs_spec.rb index 8ae95a8e8bb..c26e9b67958 100644 --- a/spec/system/support_interface/docs_spec.rb +++ b/spec/system/support_interface/docs_spec.rb @@ -42,7 +42,6 @@ def and_i_see_the_provider_flow_documentation def and_it_contains_documentation_for_all_emails emails_outside_of_states = %w[ provider_mailer-fallback_sign_in_email - candidate_mailer-one_login_is_coming candidate_mailer-one_login_has_arrived candidate_mailer-eoc_first_deadline_reminder candidate_mailer-eoc_second_deadline_reminder diff --git a/spec/workers/send_candidate_one_login_is_coming_email_worker_spec.rb b/spec/workers/send_candidate_one_login_is_coming_email_worker_spec.rb deleted file mode 100644 index 4e33927ad28..00000000000 --- a/spec/workers/send_candidate_one_login_is_coming_email_worker_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'rails_helper' - -RSpec.describe SendCandidateOneLoginIsComingEmailWorker do - before { allow(OneLogin).to receive(:bypass?).and_return(false) } - - describe '#perform' do - context 'feature flag is activated' do - before { FeatureFlag.activate('one_login_candidate_sign_in') } - - it 'does not enqueue the batch worker' do - create(:application_form) - - allow(SendOneLoginIsComingEmailBatchWorker).to receive(:perform_at) - described_class.new.perform - expect(SendOneLoginIsComingEmailBatchWorker).not_to have_received(:perform_at) - end - end - - context 'feature flag is deactivated' do - before { FeatureFlag.deactivate('one_login_candidate_sign_in') } - - it 'enqueues the batch worker with expected application forms' do - # Last year's application - create(:application_form, recruitment_cycle_year: RecruitmentCycle.previous_year) - # Unsubscribed candidate - create(:application_form, candidate: build(:candidate, unsubscribed_from_emails: true)) - # Candidate with submission blocked - create(:application_form, candidate: build(:candidate, submission_blocked: true)) - # Candidate with locked account - create(:application_form, candidate: build(:candidate, account_locked: true)) - # Candidate has already been sent the email - create(:email, application_form: build(:application_form), mailer: 'candidate_mailer', mail_template: 'one_login_is_coming') - - should_receive = create(:application_form) - - allow(SendOneLoginIsComingEmailBatchWorker).to receive(:perform_at) - described_class.new.perform - expect(SendOneLoginIsComingEmailBatchWorker).to have_received(:perform_at).with(kind_of(Time), [should_receive.id]) - end - end - end -end diff --git a/spec/workers/send_one_login_is_coming_email_batch_worker_spec.rb b/spec/workers/send_one_login_is_coming_email_batch_worker_spec.rb deleted file mode 100644 index b1a5fad66af..00000000000 --- a/spec/workers/send_one_login_is_coming_email_batch_worker_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'rails_helper' - -RSpec.describe SendOneLoginIsComingEmailBatchWorker do - describe '#perform' do - it 'enqueues candidate emails' do - application_forms = create_list(:application_form, 2) - - expect { described_class.new.perform(application_forms.pluck(:id)) } - .to have_enqueued_mail(CandidateMailer, :one_login_is_coming).twice - end - end -end