From 3cde3b9e152bc859d9311b111802b50a7f5e08ee Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 13 Feb 2024 09:44:50 +0000 Subject: [PATCH 1/3] Add consent requested email This adds an email which is sent to applicants when consent has been requested from them. --- app/mailers/teacher_mailer.rb | 11 +++++ .../teacher_mailer/consent_requested.text.erb | 24 ++++++++++ config/locales/mailer.en.yml | 2 + spec/mailers/teacher_mailer_spec.rb | 45 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 app/views/teacher_mailer/consent_requested.text.erb diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index 9186978628..e72534b236 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -56,6 +56,17 @@ def application_received ) end + def consent_requested + @expires_at = + assessment.qualification_requests.consent_required.map(&:expires_at).max + + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: I18n.t("mailer.teacher.consent_requested.subject"), + ) + end + def further_information_received view_mail( GOVUK_NOTIFY_TEMPLATE_ID, diff --git a/app/views/teacher_mailer/consent_requested.text.erb b/app/views/teacher_mailer/consent_requested.text.erb new file mode 100644 index 0000000000..117bbe41b1 --- /dev/null +++ b/app/views/teacher_mailer/consent_requested.text.erb @@ -0,0 +1,24 @@ +Dear <%= application_form_full_name(@application_form) %>, + +As part of your QTS application we need to verify some of your qualifications. To allow us to do this you need to sign and return a consent document for each qualification we need to verify. + +Consent documents have been added to your application. + +## What you need to do + +Download each document then: + +- print it +- sign it, making sure your signature is clear +- scan or photograph it +- upload the signed document + +[Sign in to access your documents](<%= new_teacher_session_url %>) + +You need to sign and upload these documents by <%= @expires_at.to_fs(:date) %> so that we can proceed with your application. + +## Why we need your written consent + +We need your written consent so we can share your data with organisations that can verify your qualifications. This is in accordance with UK General Data Protection Regulation (GDPR). + +<%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index 277aeaffd1..b40a9cd3eb 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -20,6 +20,8 @@ en: 1: Your draft QTS application will be deleted in 1 week application_received: subject: We’ve received your application for qualified teacher status (QTS) + consent_requested: + subject: We need your written consent to progress your QTS application further_information_received: subject: We’ve received the additional information you sent us further_information_requested: diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index dc8af699dc..885d6e996d 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -256,6 +256,51 @@ it_behaves_like "an observable mailer", "application_received" end + describe "#consent_requested" do + subject(:mail) { described_class.with(application_form:).consent_requested } + + before do + create( + :qualification_request, + :consent_requested, + assessment:, + consent_requested_at: Date.new(2020, 1, 1), + ) + end + + describe "#subject" do + subject(:subject) { mail.subject } + + it do + is_expected.to eq( + "We need your written consent to progress your QTS application", + ) + end + end + + describe "#to" do + subject(:to) { mail.to } + + it { is_expected.to eq(["teacher@example.com"]) } + end + + describe "#body" do + subject(:body) { mail.body.encoded } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include( + "As part of your QTS application we need to verify some of your qualifications", + ) + end + it do + is_expected.to include("upload these documents by 12 February 2020") + end + end + + it_behaves_like "an observable mailer", "consent_requested" + end + describe "#further_information_received" do subject(:mail) do described_class.with(application_form:).further_information_received From 4ed79b8bc0840557960e2a68a6710a496e17f492 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 13 Feb 2024 10:56:44 +0000 Subject: [PATCH 2/3] Add consent reminder email This adds an email that is sent to applicants when we haven't received their consent after a period of time. --- app/mailers/teacher_mailer.rb | 11 +++++ .../teacher_mailer/consent_reminder.text.erb | 24 ++++++++++ config/locales/mailer.en.yml | 2 + spec/mailers/teacher_mailer_spec.rb | 45 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 app/views/teacher_mailer/consent_reminder.text.erb diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index e72534b236..1c74f12213 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -56,6 +56,17 @@ def application_received ) end + def consent_reminder + @expires_at = + assessment.qualification_requests.consent_required.map(&:expires_at).max + + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: I18n.t("mailer.teacher.consent_reminder.subject"), + ) + end + def consent_requested @expires_at = assessment.qualification_requests.consent_required.map(&:expires_at).max diff --git a/app/views/teacher_mailer/consent_reminder.text.erb b/app/views/teacher_mailer/consent_reminder.text.erb new file mode 100644 index 0000000000..fffcc910c6 --- /dev/null +++ b/app/views/teacher_mailer/consent_reminder.text.erb @@ -0,0 +1,24 @@ +Dear <%= application_form_full_name(@application_form) %>, + +We recently wrote to you asking for your consent to verify some of your qualifications as part of your QTS application. + +We have not received your consent documents. If you do not send them by <%= @expires_at.to_fs(:date) %> we will not be able to proceed with your application. + +## What you need to do + +Download each document then: + +- print it +- sign it, making sure your signature is clear +- scan or photograph it +- upload the signed document + +[Sign in to access your documents](<%= new_teacher_session_url %>) + +You need to sign and upload these documents by <%= @expires_at.to_fs(:date) %> so that we can proceed with your application. + +## Why we need your written consent + +We need your written consent so we can share your data with organisations that can verify your qualifications. This is in accordance with UK General Data Protection Regulation (GDPR). + +<%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index b40a9cd3eb..dd65154408 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -20,6 +20,8 @@ en: 1: Your draft QTS application will be deleted in 1 week application_received: subject: We’ve received your application for qualified teacher status (QTS) + consent_reminder: + subject: "Reminder: we need your written consent to progress your QTS application" consent_requested: subject: We need your written consent to progress your QTS application further_information_received: diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index 885d6e996d..190c0cf9b7 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -256,6 +256,51 @@ it_behaves_like "an observable mailer", "application_received" end + describe "#consent_reminder" do + subject(:mail) { described_class.with(application_form:).consent_reminder } + + before do + create( + :qualification_request, + :consent_requested, + assessment:, + consent_requested_at: Date.new(2020, 1, 1), + ) + end + + describe "#subject" do + subject(:subject) { mail.subject } + + it do + is_expected.to eq( + "Reminder: we need your written consent to progress your QTS application", + ) + end + end + + describe "#to" do + subject(:to) { mail.to } + + it { is_expected.to eq(["teacher@example.com"]) } + end + + describe "#body" do + subject(:body) { mail.body.encoded } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include( + "We recently wrote to you asking for your consent", + ) + end + it do + is_expected.to include("If you do not send them by 12 February 2020") + end + end + + it_behaves_like "an observable mailer", "consent_reminder" + end + describe "#consent_requested" do subject(:mail) { described_class.with(application_form:).consent_requested } From b14031ab078e20994d53baa5fb5710fd7a73ea55 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 13 Feb 2024 11:02:27 +0000 Subject: [PATCH 3/3] Add consent submitted email This adds an email that we sent to applicants when they've submitted their consent documents. --- app/mailers/teacher_mailer.rb | 8 +++++ .../teacher_mailer/consent_submitted.text.erb | 15 +++++++++ config/locales/mailer.en.yml | 2 ++ spec/mailers/teacher_mailer_spec.rb | 32 +++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 app/views/teacher_mailer/consent_submitted.text.erb diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index 1c74f12213..7c83828e3a 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -78,6 +78,14 @@ def consent_requested ) end + def consent_submitted + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: I18n.t("mailer.teacher.consent_submitted.subject"), + ) + end + def further_information_received view_mail( GOVUK_NOTIFY_TEMPLATE_ID, diff --git a/app/views/teacher_mailer/consent_submitted.text.erb b/app/views/teacher_mailer/consent_submitted.text.erb new file mode 100644 index 0000000000..83ecf674c1 --- /dev/null +++ b/app/views/teacher_mailer/consent_submitted.text.erb @@ -0,0 +1,15 @@ +Dear <%= application_form_full_name(@application_form) %>, + +Thank you for submitting the consent documents required to progress your QTS application. + +<%= render "shared/teacher_mailer/reference_number" %> + +## What happens next? + +Once an assessor has checked the documents to make sure you’ve provided the required information, they’ll continue reviewing your application. + +If no further information is needed, we’ll contact you with a final QTS application decision once all checks and verifications have been completed. + +<%= render "shared/teacher_mailer/any_questions_contact" %> + +<%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index dd65154408..e2669fce81 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -24,6 +24,8 @@ en: subject: "Reminder: we need your written consent to progress your QTS application" consent_requested: subject: We need your written consent to progress your QTS application + consent_submitted: + subject: We’ve received your consent documents further_information_received: subject: We’ve received the additional information you sent us further_information_requested: diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index 190c0cf9b7..f4a8856d0c 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -19,6 +19,8 @@ ) end + let(:qualification) { create(:qualification, application_form:) } + describe "#application_awarded" do subject(:mail) do described_class.with(application_form:).application_awarded @@ -265,6 +267,7 @@ :consent_requested, assessment:, consent_requested_at: Date.new(2020, 1, 1), + qualification:, ) end @@ -310,6 +313,7 @@ :consent_requested, assessment:, consent_requested_at: Date.new(2020, 1, 1), + qualification:, ) end @@ -346,6 +350,34 @@ it_behaves_like "an observable mailer", "consent_requested" end + describe "#consent_submitted" do + subject(:mail) { described_class.with(application_form:).consent_submitted } + + describe "#subject" do + subject(:subject) { mail.subject } + + it { is_expected.to eq("We’ve received your consent documents") } + end + + describe "#to" do + subject(:to) { mail.to } + + it { is_expected.to eq(["teacher@example.com"]) } + end + + describe "#body" do + subject(:body) { mail.body.encoded } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include("Thank you for submitting the consent documents") + end + it { is_expected.to include("Application reference number: abc") } + end + + it_behaves_like "an observable mailer", "consent_submitted" + end + describe "#further_information_received" do subject(:mail) do described_class.with(application_form:).further_information_received