From 91909d49862ea2421cb8b87eb0285949abf0c5b2 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Mon, 13 Nov 2023 14:10:27 +0000 Subject: [PATCH 1/7] Decouple Remindable from Expirable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes the link between the two making it possible for objects which don’t expire (like teachers or application forms) to also have reminder emails. --- app/models/application_form.rb | 5 +++-- app/models/concerns/expirable.rb | 5 +++++ app/models/concerns/remindable.rb | 4 +--- app/models/further_information_request.rb | 2 +- app/models/reference_request.rb | 2 +- app/services/send_reminder_email.rb | 12 +----------- spec/models/application_form_spec.rb | 1 + spec/models/further_information_request_spec.rb | 7 ++++++- spec/models/reference_request_spec.rb | 6 +++++- spec/support/shared_examples/remindable.rb | 6 +----- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/models/application_form.rb b/app/models/application_form.rb index b46cf5e5f1..d2351506f4 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -91,6 +91,7 @@ # fk_rails_... (teacher_id => teachers.id) # class ApplicationForm < ApplicationRecord + include Expirable include Remindable belongs_to :teacher @@ -261,8 +262,8 @@ def created_under_new_regulations? created_at >= Date.parse(ENV.fetch("NEW_REGS_DATE", "2023-02-01")) end - def should_send_reminder_email?(days_until_expired, number_of_reminders_sent) - return false if teacher.application_form != self + def should_send_reminder_email?(number_of_reminders_sent) + return false if days_until_expired.nil? || teacher.application_form != self (days_until_expired <= 14 && number_of_reminders_sent.zero?) || (days_until_expired <= 7 && number_of_reminders_sent == 1) diff --git a/app/models/concerns/expirable.rb b/app/models/concerns/expirable.rb index 4676102fc4..6b6fa64280 100644 --- a/app/models/concerns/expirable.rb +++ b/app/models/concerns/expirable.rb @@ -9,6 +9,11 @@ def expires_at requested_at + expires_after end + def days_until_expired + return nil if expires_at.nil? + (expires_at.to_date - Time.zone.today).to_i + end + def expired! update!(expired_at: Time.zone.now) end diff --git a/app/models/concerns/remindable.rb b/app/models/concerns/remindable.rb index 0bccd72974..557d6bd7ee 100644 --- a/app/models/concerns/remindable.rb +++ b/app/models/concerns/remindable.rb @@ -3,11 +3,9 @@ module Remindable extend ActiveSupport::Concern - include Expirable - included { has_many :reminder_emails, as: :remindable } - def should_send_reminder_email?(days_until_expired, number_of_reminders_sent) + def should_send_reminder_email?(number_of_reminders_sent) # whether to send a reminder email at this point end diff --git a/app/models/further_information_request.rb b/app/models/further_information_request.rb index a65ce35c78..f488bb9fe7 100644 --- a/app/models/further_information_request.rb +++ b/app/models/further_information_request.rb @@ -40,7 +40,7 @@ class FurtherInformationRequest < ApplicationRecord FOUR_WEEK_COUNTRY_CODES = %w[AU CA GI NZ US].freeze - def should_send_reminder_email?(days_until_expired, number_of_reminders_sent) + def should_send_reminder_email?(number_of_reminders_sent) (days_until_expired <= 14 && number_of_reminders_sent.zero?) || (days_until_expired <= 7 && number_of_reminders_sent == 1) || (days_until_expired <= 2 && number_of_reminders_sent == 2) diff --git a/app/models/reference_request.rb b/app/models/reference_request.rb index 0ba293fb0d..cc53f73bae 100644 --- a/app/models/reference_request.rb +++ b/app/models/reference_request.rb @@ -93,7 +93,7 @@ def responses_given? ].none?(&:nil?) end - def should_send_reminder_email?(days_until_expired, number_of_reminders_sent) + def should_send_reminder_email?(number_of_reminders_sent) (days_until_expired <= 28 && number_of_reminders_sent.zero?) || (days_until_expired <= 14 && number_of_reminders_sent == 1) end diff --git a/app/services/send_reminder_email.rb b/app/services/send_reminder_email.rb index d6ed99779b..2ab25b79ab 100644 --- a/app/services/send_reminder_email.rb +++ b/app/services/send_reminder_email.rb @@ -19,23 +19,13 @@ def call attr_reader :remindable def send_reminder? - return false unless remindable.expires_at - - remindable.should_send_reminder_email?( - days_until_expired, - number_of_reminders_sent, - ) + remindable.should_send_reminder_email?(number_of_reminders_sent) end def number_of_reminders_sent remindable.reminder_emails.count end - def days_until_expired - today = Time.zone.today - (remindable.expires_at.to_date - today).to_i - end - def send_email remindable.send_reminder_email(number_of_reminders_sent) end diff --git a/spec/models/application_form_spec.rb b/spec/models/application_form_spec.rb index 9d0f870cfc..4a7d6e3e8a 100644 --- a/spec/models/application_form_spec.rb +++ b/spec/models/application_form_spec.rb @@ -102,6 +102,7 @@ ) end + it_behaves_like "an expirable" it_behaves_like "a remindable" describe "columns" do diff --git a/spec/models/further_information_request_spec.rb b/spec/models/further_information_request_spec.rb index fe1c5bc49f..91bae837e3 100644 --- a/spec/models/further_information_request_spec.rb +++ b/spec/models/further_information_request_spec.rb @@ -27,7 +27,12 @@ RSpec.describe FurtherInformationRequest do subject(:further_information_request) { create(:further_information_request) } - it_behaves_like "a remindable" + it_behaves_like "an expirable" + + it_behaves_like "a remindable" do + subject { create(:further_information_request, :requested) } + end + it_behaves_like "a requestable" describe "scopes" do diff --git a/spec/models/reference_request_spec.rb b/spec/models/reference_request_spec.rb index e825590a99..003eec342a 100644 --- a/spec/models/reference_request_spec.rb +++ b/spec/models/reference_request_spec.rb @@ -55,7 +55,11 @@ RSpec.describe ReferenceRequest do subject(:reference_request) { create(:reference_request) } - it_behaves_like "a remindable" + it_behaves_like "an expirable" + + it_behaves_like "a remindable" do + subject { create(:reference_request, :requested) } + end it_behaves_like "a requestable" do subject { create(:reference_request, :receivable) } diff --git a/spec/support/shared_examples/remindable.rb b/spec/support/shared_examples/remindable.rb index eef49799a6..b521e7150c 100644 --- a/spec/support/shared_examples/remindable.rb +++ b/spec/support/shared_examples/remindable.rb @@ -13,9 +13,7 @@ end describe "#should_send_reminder_email?" do - let(:should_send_reminder_email?) do - subject.should_send_reminder_email?(0, 0) - end + let(:should_send_reminder_email?) { subject.should_send_reminder_email?(0) } it "returns a boolean" do expect(should_send_reminder_email?).to be_in([true, false]) @@ -29,6 +27,4 @@ expect { send_reminder_email }.to have_enqueued_mail end end - - include_examples "an expirable" end From 127a15f40ac295b6052fcf8881bf2768a2d05656 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 14 Nov 2023 10:26:25 +0000 Subject: [PATCH 2/7] Add name to reminder emails This adds a new column to reminder emails for capturing the name of the reminder email, allowing us to send multiple different types of reminder emails from a single remindable. --- app/models/reminder_email.rb | 1 + config/analytics.yml | 5 +++-- db/migrate/20231114102513_add_name_to_reminder_emails.rb | 9 +++++++++ db/schema.rb | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20231114102513_add_name_to_reminder_emails.rb diff --git a/app/models/reminder_email.rb b/app/models/reminder_email.rb index 0230353309..df33d8fcfa 100644 --- a/app/models/reminder_email.rb +++ b/app/models/reminder_email.rb @@ -5,6 +5,7 @@ # Table name: reminder_emails # # id :bigint not null, primary key +# name :string default("expiration"), not null # remindable_type :string default(""), not null # created_at :datetime not null # updated_at :datetime not null diff --git a/config/analytics.yml b/config/analytics.yml index 77b4d5fe2e..24fb9071aa 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -294,11 +294,12 @@ - updated_at - written_statement_optional :reminder_emails: - - id - created_at - - updated_at + - id + - name - remindable_id - remindable_type + - updated_at :selected_failure_reasons: - id - created_at diff --git a/db/migrate/20231114102513_add_name_to_reminder_emails.rb b/db/migrate/20231114102513_add_name_to_reminder_emails.rb new file mode 100644 index 0000000000..4189d55d2c --- /dev/null +++ b/db/migrate/20231114102513_add_name_to_reminder_emails.rb @@ -0,0 +1,9 @@ +class AddNameToReminderEmails < ActiveRecord::Migration[7.1] + def change + add_column :reminder_emails, + :name, + :string, + null: false, + default: "expiration" + end +end diff --git a/db/schema.rb b/db/schema.rb index 26990e5e3d..4218fdd95f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2023_10_11_121802) do +ActiveRecord::Schema[7.1].define(version: 2023_11_14_102513) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -391,6 +391,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "remindable_type", default: "", null: false + t.string "name", default: "expiration", null: false t.index ["remindable_type", "remindable_id"], name: "index_reminder_emails_on_remindable_type_and_remindable_id" end From 70f5ef2348333e8314a51c7b27dca7d1a1121105 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 14 Nov 2023 10:29:34 +0000 Subject: [PATCH 3/7] Allow sending multiple reminder emails This adds the ability to send multiple different kinds of reminder emails from a single remindable by introducing a new method to the remindable concern and passing the name in to the methods. --- app/models/application_form.rb | 4 ++-- app/models/concerns/remindable.rb | 8 ++++++-- app/models/further_information_request.rb | 4 ++-- app/models/reference_request.rb | 4 ++-- app/services/send_reminder_email.rb | 24 ++++++++++++---------- spec/services/send_reminder_email_spec.rb | 24 ++++++++++++++-------- spec/support/shared_examples/remindable.rb | 6 ++++-- 7 files changed, 44 insertions(+), 30 deletions(-) diff --git a/app/models/application_form.rb b/app/models/application_form.rb index d2351506f4..abfbb60d1c 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -262,14 +262,14 @@ def created_under_new_regulations? created_at >= Date.parse(ENV.fetch("NEW_REGS_DATE", "2023-02-01")) end - def should_send_reminder_email?(number_of_reminders_sent) + def should_send_reminder_email?(_name, number_of_reminders_sent) return false if days_until_expired.nil? || teacher.application_form != self (days_until_expired <= 14 && number_of_reminders_sent.zero?) || (days_until_expired <= 7 && number_of_reminders_sent == 1) end - def send_reminder_email(number_of_reminders_sent) + def send_reminder_email(_name, number_of_reminders_sent) TeacherMailer .with(teacher:, number_of_reminders_sent:) .application_not_submitted diff --git a/app/models/concerns/remindable.rb b/app/models/concerns/remindable.rb index 557d6bd7ee..de678e86ae 100644 --- a/app/models/concerns/remindable.rb +++ b/app/models/concerns/remindable.rb @@ -5,11 +5,15 @@ module Remindable included { has_many :reminder_emails, as: :remindable } - def should_send_reminder_email?(number_of_reminders_sent) + def reminder_email_names + %w[expiration] + end + + def should_send_reminder_email?(type, number_of_reminders_sent) # whether to send a reminder email at this point end - def send_reminder_email(number_of_reminders_sent) + def send_reminder_email(type, number_of_reminders_sent) # send a suitable reminder email for this object end end diff --git a/app/models/further_information_request.rb b/app/models/further_information_request.rb index f488bb9fe7..9fdfb18b2e 100644 --- a/app/models/further_information_request.rb +++ b/app/models/further_information_request.rb @@ -40,13 +40,13 @@ class FurtherInformationRequest < ApplicationRecord FOUR_WEEK_COUNTRY_CODES = %w[AU CA GI NZ US].freeze - def should_send_reminder_email?(number_of_reminders_sent) + def should_send_reminder_email?(_name, number_of_reminders_sent) (days_until_expired <= 14 && number_of_reminders_sent.zero?) || (days_until_expired <= 7 && number_of_reminders_sent == 1) || (days_until_expired <= 2 && number_of_reminders_sent == 2) end - def send_reminder_email(_number_of_reminders_sent) + def send_reminder_email(_name, _number_of_reminders_sent) TeacherMailer .with(teacher:, further_information_request: self) .further_information_reminder diff --git a/app/models/reference_request.rb b/app/models/reference_request.rb index cc53f73bae..633046b043 100644 --- a/app/models/reference_request.rb +++ b/app/models/reference_request.rb @@ -93,12 +93,12 @@ def responses_given? ].none?(&:nil?) end - def should_send_reminder_email?(number_of_reminders_sent) + def should_send_reminder_email?(_name, number_of_reminders_sent) (days_until_expired <= 28 && number_of_reminders_sent.zero?) || (days_until_expired <= 14 && number_of_reminders_sent == 1) end - def send_reminder_email(_number_of_reminders_sent) + def send_reminder_email(_name, _number_of_reminders_sent) RefereeMailer.with(reference_request: self).reference_reminder.deliver_later end diff --git a/app/services/send_reminder_email.rb b/app/services/send_reminder_email.rb index 2ab25b79ab..0071eab45d 100644 --- a/app/services/send_reminder_email.rb +++ b/app/services/send_reminder_email.rb @@ -8,9 +8,11 @@ def initialize(remindable:) end def call - if send_reminder? - send_email - record_reminder + remindable.reminder_email_names.each do |name| + if send_reminder?(name) + send_email(name) + record_reminder(name) + end end end @@ -18,19 +20,19 @@ def call attr_reader :remindable - def send_reminder? - remindable.should_send_reminder_email?(number_of_reminders_sent) + def send_reminder?(name) + remindable.should_send_reminder_email?(name, number_of_reminders_sent(name)) end - def number_of_reminders_sent - remindable.reminder_emails.count + def number_of_reminders_sent(name) + remindable.reminder_emails.where(name:).count end - def send_email - remindable.send_reminder_email(number_of_reminders_sent) + def send_email(name) + remindable.send_reminder_email(name, number_of_reminders_sent(name)) end - def record_reminder - remindable.reminder_emails.create! + def record_reminder(name) + remindable.reminder_emails.create!(name:) end end diff --git a/spec/services/send_reminder_email_spec.rb b/spec/services/send_reminder_email_spec.rb index 532aeae457..e0939ef779 100644 --- a/spec/services/send_reminder_email_spec.rb +++ b/spec/services/send_reminder_email_spec.rb @@ -18,9 +18,9 @@ shared_examples "sends an email" do it "logs an email" do - expect { call }.to change { ReminderEmail.where(remindable:).count }.by( - 1, - ) + expect { call }.to change { + ReminderEmail.where(remindable:, name: "expiration").count + }.by(1) end end @@ -75,12 +75,14 @@ end context "when a previous reminder has been sent" do - before { remindable.reminder_emails.create } + before { remindable.reminder_emails.create!(name: "expiration") } include_examples "doesn't send an email" end context "when two previous reminders have been sent" do - before { 2.times { remindable.reminder_emails.create } } + before do + 2.times { remindable.reminder_emails.create!(name: "expiration") } + end include_examples "doesn't send an email" end end @@ -91,12 +93,14 @@ end context "when one previous reminder has been sent" do - before { remindable.reminder_emails.create } + before { remindable.reminder_emails.create!(name: "expiration") } include_examples shared_example end context "when two previous reminders have been sent" do - before { 2.times { remindable.reminder_emails.create } } + before do + 2.times { remindable.reminder_emails.create!(name: "expiration") } + end include_examples "doesn't send an email" end end @@ -107,12 +111,14 @@ end context "when one previous reminder has been sent" do - before { remindable.reminder_emails.create } + before { remindable.reminder_emails.create!(name: "expiration") } include_examples shared_example end context "when two previous reminders have been sent" do - before { 2.times { remindable.reminder_emails.create } } + before do + 2.times { remindable.reminder_emails.create!(name: "expiration") } + end include_examples shared_example end end diff --git a/spec/support/shared_examples/remindable.rb b/spec/support/shared_examples/remindable.rb index b521e7150c..0b2398d7c2 100644 --- a/spec/support/shared_examples/remindable.rb +++ b/spec/support/shared_examples/remindable.rb @@ -13,7 +13,9 @@ end describe "#should_send_reminder_email?" do - let(:should_send_reminder_email?) { subject.should_send_reminder_email?(0) } + let(:should_send_reminder_email?) do + subject.should_send_reminder_email?("type", 0) + end it "returns a boolean" do expect(should_send_reminder_email?).to be_in([true, false]) @@ -21,7 +23,7 @@ end describe "#send_reminder_email" do - let(:send_reminder_email) { subject.send_reminder_email(0) } + let(:send_reminder_email) { subject.send_reminder_email("type", 0) } it "enqueues an email" do expect { send_reminder_email }.to have_enqueued_mail From 3ac11daa936afe135e41bd58b587851b813e569a Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 14 Nov 2023 07:35:42 +0000 Subject: [PATCH 4/7] Add references reminder email This adds the reminder email sent to teachers when their references haven't been returned promptly. --- app/mailers/teacher_mailer.rb | 14 ++++ .../references_reminder.text.erb | 17 +++++ config/locales/mailer.en.yml | 4 + spec/mailers/teacher_mailer_spec.rb | 75 +++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 app/views/teacher_mailer/references_reminder.text.erb diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index 24ff4d3980..c61a49ac2b 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -94,6 +94,20 @@ def professional_standing_received ) end + def references_reminder + @number_of_reminders_sent = params[:number_of_reminders_sent] + @reference_requests = params[:reference_requests] + + view_mail( + GOVUK_NOTIFY_TEMPLATE_ID, + to: teacher.email, + subject: + I18n.t( + "mailer.teacher.references_reminder.subject.#{@number_of_reminders_sent}", + ), + ) + end + def references_requested view_mail( GOVUK_NOTIFY_TEMPLATE_ID, diff --git a/app/views/teacher_mailer/references_reminder.text.erb b/app/views/teacher_mailer/references_reminder.text.erb new file mode 100644 index 0000000000..b38fbbad5f --- /dev/null +++ b/app/views/teacher_mailer/references_reminder.text.erb @@ -0,0 +1,17 @@ +Dear <%= application_form_full_name(@application_form) %> + +## We’re still waiting for a response from one or more of the references you provided to verify your work history. + +<% if @number_of_reminders_sent == 0 %> +We contacted your references on <%= @reference_requests.first.requested_at.to_date.to_fs(:long_ordinal_uk) %> but have not received a response from: +<% elsif @number_of_reminders_sent == 1 %> +The following references have just 2 weeks to respond to the reference request. +<% end %> + +<% @reference_requests.each do |reference_request| %> +- <%= reference_request.work_history.contact_name %> — <%= reference_request.work_history.school_name %> +<% end %> + +They need to respond by <%= @reference_requests.first.expires_at.to_date.to_fs(:long_ordinal_uk) %>. If your references do not respond, and, as a result, we cannot verify your work history, we may not be able to award you QTS. You should contact your reference to remind them about the request. + +<%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index 41ce1cc8cf..dbf8f1aa87 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -28,6 +28,10 @@ en: subject: Your qualified teacher status application – we’ve received your %{certificate} references_requested: subject: Your qualified teacher status application – we’ve contacted your references + references_reminder: + subject: + 0: Waiting on references – QTS application + 1: Your references only have two weeks left to respond teaching_authority: application_submitted: subject: "%{name} has made an application for qualified teacher status (QTS) in England" diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index aa19157b5e..d7b4d2e5e4 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -366,6 +366,81 @@ it_behaves_like "an observable mailer", "professional_standing_received" end + describe "#references_reminder" do + let(:reference_request) do + create( + :reference_request, + requested_at: Date.new(2020, 1, 1), + work_history: + create( + :work_history, + school_name: "St Smith School", + contact_name: "John Smith", + ), + assessment:, + ) + end + let(:number_of_reminders_sent) { nil } + subject(:mail) do + described_class.with( + teacher:, + number_of_reminders_sent:, + reference_requests: [reference_request], + ).references_reminder + end + + describe "#subject" do + subject(:subject) { mail.subject } + + context "with no reminder emails" do + let(:number_of_reminders_sent) { 0 } + it { is_expected.to eq("Waiting on references – QTS application") } + end + + context "with one reminder email" do + let(:number_of_reminders_sent) { 1 } + it do + is_expected.to eq( + "Your references only have two weeks left to respond", + ) + end + 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 } + + let(:number_of_reminders_sent) { 0 } + + it { is_expected.to include("Dear First Last") } + it do + is_expected.to include( + "We’re still waiting for a response from one or more of the " \ + "references you provided to verify your work history.", + ) + end + it { is_expected.to include("John Smith — St Smith School") } + + context "when the second reminder email" do + let(:number_of_reminders_sent) { 1 } + + it do + is_expected.to include( + "The following references have just 2 weeks to respond to the reference request.", + ) + end + end + end + + it_behaves_like "an observable mailer", "references_reminder" + end + describe "#references_requested" do subject(:mail) { described_class.with(teacher:).references_requested } From 48d477f1d7c4ec1774fdf9e9bf9ed98121faaf65 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 15 Nov 2023 11:14:18 +0000 Subject: [PATCH 5/7] Send reminder reference emails This updates the application form to send reminder emails for references. --- app/models/application_form.rb | 60 ++++++++-- spec/services/send_reminder_email_spec.rb | 127 ++++++++++++++++----- spec/support/shared_examples/remindable.rb | 4 +- 3 files changed, 149 insertions(+), 42 deletions(-) diff --git a/app/models/application_form.rb b/app/models/application_form.rb index abfbb60d1c..1f52837f1b 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -220,7 +220,12 @@ class ApplicationForm < ApplicationRecord .or(withdrawn.where("withdrawn_at < ?", 5.years.ago)) end - scope :remindable, -> { draft.where("created_at < ?", 5.months.ago) } + scope :remindable, + -> do + verification_stage.or( + draft_stage.where("created_at < ?", 5.months.ago), + ) + end def to_param reference @@ -262,18 +267,46 @@ def created_under_new_regulations? created_at >= Date.parse(ENV.fetch("NEW_REGS_DATE", "2023-02-01")) end - def should_send_reminder_email?(_name, number_of_reminders_sent) - return false if days_until_expired.nil? || teacher.application_form != self + def reminder_email_names + %w[expiration references] + end - (days_until_expired <= 14 && number_of_reminders_sent.zero?) || - (days_until_expired <= 7 && number_of_reminders_sent == 1) + def should_send_reminder_email?(name, number_of_reminders_sent) + return false if teacher.application_form != self + + case name + when "expiration" + return false if days_until_expired.nil? + + (days_until_expired <= 14 && number_of_reminders_sent.zero?) || + (days_until_expired <= 7 && number_of_reminders_sent == 1) + when "references" + unreviewed_reference_requests.any? do |reference_request| + reference_request.should_send_reminder_email?( + "expiration", + number_of_reminders_sent, + ) + end + end end - def send_reminder_email(_name, number_of_reminders_sent) - TeacherMailer - .with(teacher:, number_of_reminders_sent:) - .application_not_submitted - .deliver_later + def send_reminder_email(name, number_of_reminders_sent) + case name + when "expiration" + TeacherMailer + .with(teacher:, number_of_reminders_sent:) + .application_not_submitted + .deliver_later + when "references" + TeacherMailer + .with( + teacher:, + number_of_reminders_sent:, + reference_requests: unreviewed_reference_requests.to_a, + ) + .references_reminder + .deliver_later + end end def expires_after @@ -293,4 +326,11 @@ def build_documents documents.build(document_type: :english_language_proficiency) documents.build(document_type: :written_statement) end + + def unreviewed_reference_requests + ReferenceRequest + .joins(:work_history) + .where(work_histories: { application_form_id: id }) + .where(received_at: nil, expired_at: nil) + end end diff --git a/spec/services/send_reminder_email_spec.rb b/spec/services/send_reminder_email_spec.rb index e0939ef779..8b6082172b 100644 --- a/spec/services/send_reminder_email_spec.rb +++ b/spec/services/send_reminder_email_spec.rb @@ -16,16 +16,16 @@ end end - shared_examples "sends an email" do + shared_examples "sends an email" do |name| it "logs an email" do expect { call }.to change { - ReminderEmail.where(remindable:, name: "expiration").count + ReminderEmail.where(remindable:, name:).count }.by(1) end end shared_examples "sends a further information reminder email" do - include_examples "sends an email" + include_examples "sends an email", "expiration" it "sends an email" do expect { call }.to have_enqueued_mail( @@ -42,7 +42,7 @@ end shared_examples "sends a reference reminder email" do - include_examples "sends an email" + include_examples "sends an email", "expiration" it "sends an email" do expect { subject }.to have_enqueued_mail( @@ -53,7 +53,7 @@ end shared_examples "sends an application not submitted email" do - include_examples "sends an email" + include_examples "sends an email", "expiration" it "sends an email" do expect { subject }.to have_enqueued_mail( @@ -69,56 +69,68 @@ end end - shared_examples "first reminder email" do |shared_example| + shared_examples "sends an application references reminder email" do + include_examples "sends an email", "references" + + it "sends an email" do + expect { subject }.to have_enqueued_mail( + TeacherMailer, + :references_reminder, + ).with( + params: { + teacher: remindable.teacher, + number_of_reminders_sent: a_kind_of(Integer), + reference_requests: [reference_request], + }, + args: [], + ) + end + end + + shared_examples "first reminder email" do |shared_example, name| context "when no previous reminder has been sent" do include_examples shared_example end context "when a previous reminder has been sent" do - before { remindable.reminder_emails.create!(name: "expiration") } + before { remindable.reminder_emails.create!(name:) } include_examples "doesn't send an email" end context "when two previous reminders have been sent" do - before do - 2.times { remindable.reminder_emails.create!(name: "expiration") } - end + before { 2.times { remindable.reminder_emails.create!(name:) } } include_examples "doesn't send an email" end end - shared_examples "second reminder email" do |shared_example| + shared_examples "second reminder email" do |shared_example, name| context "when no previous reminder has been sent" do include_examples shared_example end context "when one previous reminder has been sent" do - before { remindable.reminder_emails.create!(name: "expiration") } + before { remindable.reminder_emails.create!(name:) } include_examples shared_example end context "when two previous reminders have been sent" do - before do - 2.times { remindable.reminder_emails.create!(name: "expiration") } - end + before { 2.times { remindable.reminder_emails.create!(name:) } } include_examples "doesn't send an email" end end - shared_examples "third reminder email" do |shared_example| + shared_examples "third reminder email" do |shared_example, name| context "when no previous reminder has been sent" do include_examples shared_example end context "when one previous reminder has been sent" do - before { remindable.reminder_emails.create!(name: "expiration") } + before { remindable.reminder_emails.create!(name:) } include_examples shared_example end context "when two previous reminders have been sent" do - before do - 2.times { remindable.reminder_emails.create!(name: "expiration") } - end + before { 2.times { remindable.reminder_emails.create!(name:) } } include_examples shared_example end end @@ -131,13 +143,15 @@ context "with less than two weeks remaining" do let(:application_created_at) { (6.months - 13.days).ago } include_examples "first reminder email", - "sends an application not submitted email" + "sends an application not submitted email", + "expiration" end context "with less than one week remaining" do let(:application_created_at) { (6.months - 1.day).ago } include_examples "second reminder email", - "sends an application not submitted email" + "sends an application not submitted email", + "expiration" end end @@ -150,19 +164,22 @@ context "with less than two weeks remaining" do let(:further_information_requested_at) { (6.weeks - 13.days).ago } include_examples "first reminder email", - "sends a further information reminder email" + "sends a further information reminder email", + "expiration" end context "with less than one week remaining" do let(:further_information_requested_at) { (6.weeks - 5.days).ago } include_examples "second reminder email", - "sends a further information reminder email" + "sends a further information reminder email", + "expiration" end context "with one day remaining" do let(:further_information_requested_at) { (6.weeks - 47.hours).ago } include_examples "third reminder email", - "sends a further information reminder email" + "sends a further information reminder email", + "expiration" end end @@ -170,19 +187,22 @@ context "with less than two weeks remaining" do let(:further_information_requested_at) { (4.weeks - 13.days).ago } include_examples "first reminder email", - "sends a further information reminder email" + "sends a further information reminder email", + "expiration" end context "with less than one week remaining" do let(:further_information_requested_at) { (4.weeks - 5.days).ago } include_examples "second reminder email", - "sends a further information reminder email" + "sends a further information reminder email", + "expiration" end context "with one day remaining" do let(:further_information_requested_at) { (4.weeks - 47.hours).ago } include_examples "third reminder email", - "sends a further information reminder email" + "sends a further information reminder email", + "expiration" end end @@ -276,13 +296,15 @@ context "with less than four weeks remaining" do let(:reference_requested_at) { (6.weeks - 27.days).ago } include_examples "first reminder email", - "sends a reference reminder email" + "sends a reference reminder email", + "expiration" end context "with less than two weeks remaining" do let(:reference_requested_at) { (6.weeks - 13.days).ago } include_examples "second reminder email", - "sends a reference reminder email" + "sends a reference reminder email", + "expiration" end end @@ -299,5 +321,50 @@ end include_examples "doesn't send an email" end + + context "with a teacher with an remindable reference request" do + let(:remindable) { create(:application_form, :submitted) } + let(:assessment) { create(:assessment, application_form: remindable) } + let!(:reference_request) do + create( + :reference_request, + requested_at: reference_requested_at, + assessment:, + ) + end + + context "with less than four weeks remaining" do + let(:reference_requested_at) { (6.weeks - 27.days).ago } + include_examples "first reminder email", + "sends an application references reminder email", + "references" + end + + context "with less than two weeks remaining" do + let(:reference_requested_at) { (6.weeks - 13.days).ago } + include_examples "second reminder email", + "sends an application references reminder email", + "references" + end + + context "with more than four weeks remaining" do + let(:reference_requested_at) { 2.days.ago } + include_examples "doesn't send an email" + end + + context "with a received reference request" do + let!(:reference_request) do + create(:reference_request, :received, requested_at: Time.zone.now) + end + include_examples "doesn't send an email" + end + + context "with an expired reference request" do + let!(:reference_request) do + create(:reference_request, :expired, requested_at: Time.zone.now) + end + include_examples "doesn't send an email" + end + end end end diff --git a/spec/support/shared_examples/remindable.rb b/spec/support/shared_examples/remindable.rb index 0b2398d7c2..97a9d9bbfd 100644 --- a/spec/support/shared_examples/remindable.rb +++ b/spec/support/shared_examples/remindable.rb @@ -14,7 +14,7 @@ describe "#should_send_reminder_email?" do let(:should_send_reminder_email?) do - subject.should_send_reminder_email?("type", 0) + subject.should_send_reminder_email?("expiration", 0) end it "returns a boolean" do @@ -23,7 +23,7 @@ end describe "#send_reminder_email" do - let(:send_reminder_email) { subject.send_reminder_email("type", 0) } + let(:send_reminder_email) { subject.send_reminder_email("expiration", 0) } it "enqueues an email" do expect { send_reminder_email }.to have_enqueued_mail From 1e1a30a3ae2a2f9dd38c054906410e37c15c749a Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 15 Nov 2023 16:29:35 +0000 Subject: [PATCH 6/7] Update reference emails content This updates the content for reference emails that we send to applicants and referees. --- ...ssment_recommendation_verify_controller.rb | 1 - app/mailers/referee_mailer.rb | 4 ++- app/mailers/teacher_mailer.rb | 2 ++ app/models/reference_request.rb | 7 +++-- app/services/update_work_history_contact.rb | 5 ++- app/services/verify_assessment.rb | 5 ++- .../preview_teacher.html.erb | 3 ++ .../reference_reminder.text.erb | 31 ++++++++++++++++--- .../reference_requested.text.erb | 22 +++++++------ .../references_requested.text.erb | 8 +++-- config/locales/mailer.en.yml | 8 +++-- spec/mailers/referee_mailer_spec.rb | 13 +++++--- spec/mailers/teacher_mailer_spec.rb | 13 +++++--- spec/services/send_reminder_email_spec.rb | 8 ++++- 14 files changed, 93 insertions(+), 37 deletions(-) diff --git a/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb b/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb index ef63c5f56d..eb53d289ed 100644 --- a/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb +++ b/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb @@ -207,7 +207,6 @@ def update_reference_requests def preview_referee authorize %i[assessor_interface assessment_recommendation], :edit? - @reference_requests = assessment.reference_requests end def preview_teacher diff --git a/app/mailers/referee_mailer.rb b/app/mailers/referee_mailer.rb index fa2260d7a9..426b5b3a88 100644 --- a/app/mailers/referee_mailer.rb +++ b/app/mailers/referee_mailer.rb @@ -8,12 +8,14 @@ class RefereeMailer < ApplicationMailer helper :application_form def reference_reminder + @number_of_reminders_sent = params[:number_of_reminders_sent] + view_mail( GOVUK_NOTIFY_TEMPLATE_ID, to: work_history.contact_email, subject: I18n.t( - "mailer.referee.reference_reminder.subject", + "mailer.referee.reference_reminder.subject.#{@number_of_reminders_sent}", name: application_form_full_name(application_form), ), ) diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index c61a49ac2b..d6e5968b3a 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -109,6 +109,8 @@ def references_reminder end def references_requested + @reference_requests = params[:reference_requests] + view_mail( GOVUK_NOTIFY_TEMPLATE_ID, to: teacher.email, diff --git a/app/models/reference_request.rb b/app/models/reference_request.rb index 633046b043..6d2733f39f 100644 --- a/app/models/reference_request.rb +++ b/app/models/reference_request.rb @@ -98,8 +98,11 @@ def should_send_reminder_email?(_name, number_of_reminders_sent) (days_until_expired <= 14 && number_of_reminders_sent == 1) end - def send_reminder_email(_name, _number_of_reminders_sent) - RefereeMailer.with(reference_request: self).reference_reminder.deliver_later + def send_reminder_email(_name, number_of_reminders_sent) + RefereeMailer + .with(reference_request: self, number_of_reminders_sent:) + .reference_reminder + .deliver_later end def expires_after diff --git a/app/services/update_work_history_contact.rb b/app/services/update_work_history_contact.rb index 562f1ca55d..2c24c2360f 100644 --- a/app/services/update_work_history_contact.rb +++ b/app/services/update_work_history_contact.rb @@ -27,7 +27,10 @@ def call if email.present? && (reference_request = work_history.reference_request) RefereeMailer.with(reference_request:).reference_requested.deliver_later - TeacherMailer.with(teacher:).references_requested.deliver_later + TeacherMailer + .with(teacher:, reference_requests: [reference_request]) + .references_requested + .deliver_later end end diff --git a/app/services/verify_assessment.rb b/app/services/verify_assessment.rb index 81ebe411c5..a704961c04 100644 --- a/app/services/verify_assessment.rb +++ b/app/services/verify_assessment.rb @@ -83,6 +83,9 @@ def send_reference_request_emails(reference_requests) RefereeMailer.with(reference_request:).reference_requested.deliver_later end - TeacherMailer.with(teacher:).references_requested.deliver_later + TeacherMailer + .with(teacher:, reference_requests:) + .references_requested + .deliver_later end end diff --git a/app/views/assessor_interface/assessment_recommendation_verify/preview_teacher.html.erb b/app/views/assessor_interface/assessment_recommendation_verify/preview_teacher.html.erb index dbb06ae6c6..a79dffc3cb 100644 --- a/app/views/assessor_interface/assessment_recommendation_verify/preview_teacher.html.erb +++ b/app/views/assessor_interface/assessment_recommendation_verify/preview_teacher.html.erb @@ -11,6 +11,9 @@ mailer_class: TeacherMailer, name: :references_requested, teacher: @application_form.teacher, + reference_requests: [OpenStruct.new( + expires_at: Time.zone.now + 6.weeks, + )], )) %>
diff --git a/app/views/referee_mailer/reference_reminder.text.erb b/app/views/referee_mailer/reference_reminder.text.erb index 235afe769a..595c85cfca 100644 --- a/app/views/referee_mailer/reference_reminder.text.erb +++ b/app/views/referee_mailer/reference_reminder.text.erb @@ -1,14 +1,35 @@ Dear <%= @work_history.contact_name %> -We still need you to confirm some information about <%= application_form_full_name(@application_form) %> as part of their application for qualified teacher status (QTS) in England. +<% if @number_of_reminders_sent == 1 %> +You have just 2 weeks to complete the reference request for <%= application_form_full_name(@application_form) %>. +<% end %> -We recently contacted you to ask you to help us confirm that the information <%= application_form_full_name(@application_form) %> has provided about their work history and experience is accurate. +<%= application_form_full_name(@application_form) %> has applied for qualified teacher status (QTS) in England. -Please follow the link below and answer the questions by <%= @reference_request.expires_at.to_date.to_fs(:long_ordinal_uk) %>. If we do not receive your response by this date, it could affect the outcome for the applicant. +<% if @number_of_reminders_sent == 0 %> +We recently asked you to confirm the information they’ve provided about their work history and experience. We have not yet received a response from you. The applicant may not be awarded QTS if we cannot confirm the information they have provided. +<% elsif @number_of_reminders_sent == 1 %> +They have given us your name and email address to confirm the information they’ve provided about their work history and experience. + +The applicant may not be awarded QTS if we cannot confirm the information they have provided. +<% end %> + +# What you need to do + +You need to answer a few questions about <%= application_form_full_name(@application_form) %> by <%= @reference_request.expires_at.to_date.to_fs(:long_ordinal_uk) %>. This should take no longer than 5 minutes. + +Follow the link below to start. <%= teacher_interface_reference_request_url(@reference_request.slug) %> -It should take no longer than 5 minutes. +# About QTS + +QTS is a legal requirement to teach in many English schools, and most schools prefer their teachers to have it. + +<%= application_form_full_name(@application_form) %> has not applied for a job. Having QTS does not guarantee a job or give someone the right to work in England. + +The QTS application allows us to assess a person’s teacher training and experience to understand if they have the skills and qualifications needed to gain QTS in England. Kind regards, -The Teacher Qualifications Team (part of the Teaching Regulation Agency) +Teaching Regulation Authority (TRA) +(an executive agency sponsored by the Department for Education, England) diff --git a/app/views/referee_mailer/reference_requested.text.erb b/app/views/referee_mailer/reference_requested.text.erb index 53bf469bf8..8f80fc68a3 100644 --- a/app/views/referee_mailer/reference_requested.text.erb +++ b/app/views/referee_mailer/reference_requested.text.erb @@ -1,22 +1,26 @@ Dear <%= @work_history.contact_name %> -We need you to confirm some information about <%= application_form_full_name(@application_form) %> as part of their application for qualified teacher status (QTS) in England. +<%= application_form_full_name(@application_form) %> has applied for qualified teacher status (QTS) in England. -As part of the QTS application process, our assessors need to understand each applicant’s work history and experience. +They have given us your name and email address to confirm the information they’ve provided about their work history and experience. -<%= application_form_full_name(@application_form) %> has given us your name and email address to help us confirm that the information they’ve provided about their work history and experience is accurate. +# What you need to do -# About QTS +You need to answer a few questions about <%= application_form_full_name(@application_form) %> by <%= @reference_request.expires_at.to_date.to_fs(:long_ordinal_uk) %>. This should take no longer than 5 minutes. -<%= application_form_full_name(@application_form) %> is NOT applying for a job – their QTS application just allows us to assess their qualifications and teaching experience to understand whether they can teach in England. +Follow the link below to start. -# What we need you to do +<%= teacher_interface_reference_request_url(@reference_request.slug) %> -Please follow the link below and answer the questions by <%= @reference_request.expires_at.to_date.to_fs(:long_ordinal_uk) %>. +Please complete the reference by the due date. The applicant may not be awarded QTS if we cannot confirm the information they have provided. -<%= teacher_interface_reference_request_url(@reference_request.slug) %> +# About QTS + +QTS is a legal requirement to teach in many English schools, and most schools prefer their teachers to have it. + +<%= application_form_full_name(@application_form) %> has not applied for a job. Having QTS does not guarantee a job or give someone the right to work in England. -It should take no longer than 5 minutes. +The QTS application allows us to assess a person’s teacher training and experience to understand if they have the skills and qualifications needed to gain QTS in England. Kind regards, Teaching Regulation Authority (TRA) diff --git a/app/views/teacher_mailer/references_requested.text.erb b/app/views/teacher_mailer/references_requested.text.erb index dc6399ec2b..8adc9dc0ba 100644 --- a/app/views/teacher_mailer/references_requested.text.erb +++ b/app/views/teacher_mailer/references_requested.text.erb @@ -1,9 +1,11 @@ Dear <%= application_form_full_name(@application_form) %> -# We’ve contacted the references you provided to verify your work history +We’ve contacted the references you provided to verify the work history information you gave as part of your QTS application. -As part of your QTS application we’ve contacted the references that you provided. +They need to respond by <%= @reference_requests.first.expires_at.to_date.to_fs(:long_ordinal_uk) %>. If your references do not respond, and, as a result, we cannot verify your work history, we may not be able to award you QTS. -Once they reply, we’ll review the references and proceed with assessing your application. +Contact them to make sure they have received the request. They may need to check their junk email folder. + +If they have not received the request, email QTS.Enquiries@education.gov.uk <%= render "shared/teacher_mailer/footer" %> diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml index dbf8f1aa87..ffc63d9e3b 100644 --- a/config/locales/mailer.en.yml +++ b/config/locales/mailer.en.yml @@ -2,9 +2,11 @@ en: mailer: referee: reference_reminder: - subject: We still need you to verify %{name}’s application for qualified teacher status (QTS) + subject: + 0: Waiting on reference request for %{name}’s application for QTS + 1: Please complete reference request for %{name}’s application for QTS reference_requested: - subject: Please help us to verify %{name}’s application for qualified teacher status (QTS) + subject: Reference request for %{name}’s application for qualified teacher status (QTS) teacher: application_awarded: subject: Your QTS application was successful @@ -27,7 +29,7 @@ en: professional_standing_received: subject: Your qualified teacher status application – we’ve received your %{certificate} references_requested: - subject: Your qualified teacher status application – we’ve contacted your references + subject: We’ve contacted your references – QTS application references_reminder: subject: 0: Waiting on references – QTS application diff --git a/spec/mailers/referee_mailer_spec.rb b/spec/mailers/referee_mailer_spec.rb index 86577f66c0..ab477a67e3 100644 --- a/spec/mailers/referee_mailer_spec.rb +++ b/spec/mailers/referee_mailer_spec.rb @@ -23,7 +23,10 @@ describe "#reference_reminder" do subject(:mail) do - described_class.with(reference_request:).reference_reminder + described_class.with( + reference_request:, + number_of_reminders_sent: 0, + ).reference_reminder end describe "#subject" do @@ -31,7 +34,7 @@ it do is_expected.to eq( - "We still need you to verify First Last’s application for qualified teacher status (QTS)", + "Waiting on reference request for First Last’s application for QTS", ) end end @@ -48,7 +51,7 @@ it { is_expected.to include("Dear Contact Name") } it do is_expected.to include( - "We still need you to confirm some information about First Last", + "You need to answer a few questions about First Last", ) end it do @@ -71,7 +74,7 @@ it do is_expected.to eq( - "Please help us to verify First Last’s application for qualified teacher status (QTS)", + "Reference request for First Last’s application for qualified teacher status (QTS)", ) end end @@ -88,7 +91,7 @@ it { is_expected.to include("Dear Contact Name") } it do is_expected.to include( - "We need you to confirm some information about First Last", + "You need to answer a few questions about First Last", ) end it do diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index d7b4d2e5e4..359652f426 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -442,15 +442,18 @@ end describe "#references_requested" do - subject(:mail) { described_class.with(teacher:).references_requested } + subject(:mail) do + described_class.with( + teacher:, + reference_requests: [create(:reference_request, :requested)], + ).references_requested + end describe "#subject" do subject(:subject) { mail.subject } it do - is_expected.to eq( - "Your qualified teacher status application – we’ve contacted your references", - ) + is_expected.to eq("We’ve contacted your references – QTS application") end end @@ -466,7 +469,7 @@ it { is_expected.to include("Dear First Last") } it do is_expected.to include( - "We’ve contacted the references you provided to verify your work history", + "We’ve contacted the references you provided to verify the work history", ) end end diff --git a/spec/services/send_reminder_email_spec.rb b/spec/services/send_reminder_email_spec.rb index 8b6082172b..ff9e9abecb 100644 --- a/spec/services/send_reminder_email_spec.rb +++ b/spec/services/send_reminder_email_spec.rb @@ -48,7 +48,13 @@ expect { subject }.to have_enqueued_mail( RefereeMailer, :reference_reminder, - ).with(params: { reference_request: remindable }, args: []) + ).with( + params: { + reference_request: remindable, + number_of_reminders_sent: a_kind_of(Integer), + }, + args: [], + ) end end From 6fe5904cb75e1672c2344770fca97f9bf7f67298 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Thu, 16 Nov 2023 09:39:04 +0000 Subject: [PATCH 7/7] Make email addresses links This ensures that any email addresses in mailer views are rendered as clickable links. --- app/views/shared/teacher_mailer/_any_questions_contact.text.erb | 2 +- app/views/teacher_mailer/application_declined.text.erb | 2 +- app/views/teacher_mailer/initial_checks_passed.text.erb | 2 +- app/views/teacher_mailer/references_requested.text.erb | 2 +- .../teaching_authority_mailer/application_submitted.text.erb | 2 +- spec/mailers/teaching_authority_mailer_spec.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/shared/teacher_mailer/_any_questions_contact.text.erb b/app/views/shared/teacher_mailer/_any_questions_contact.text.erb index e9cc6a1902..ee5e1baa1f 100644 --- a/app/views/shared/teacher_mailer/_any_questions_contact.text.erb +++ b/app/views/shared/teacher_mailer/_any_questions_contact.text.erb @@ -1 +1 @@ -If you have any questions, contact: <%= t("service.email.enquiries") %> +If you have any questions, contact: [<%= t("service.email.enquiries") %>](mailto:<%= t("service.email.enquiries") %>) diff --git a/app/views/teacher_mailer/application_declined.text.erb b/app/views/teacher_mailer/application_declined.text.erb index cf26828a54..d2cd1f3bb8 100644 --- a/app/views/teacher_mailer/application_declined.text.erb +++ b/app/views/teacher_mailer/application_declined.text.erb @@ -34,7 +34,7 @@ If you would like to request a decision review, you’ll need to provide: - formal evidence and reasoning as to how you meet the required assessment criteria - additional information not included in your original application that would support your decision review -Your request for review must be received within 28 days of receipt of the decision to decline QTS. Email your request for review, including the information required as above, to <%= t("service.email.enquiries") %>. +Your request for review must be received within 28 days of receipt of the decision to decline QTS. Email your request for review, including the information required as above, to [<%= t("service.email.enquiries") %>](mailto:<%= t("service.email.enquiries") %>). If you are not satisfied with the outcome of the decision review, you can request a final formal appeal to a senior Teacher Qualification Manager. diff --git a/app/views/teacher_mailer/initial_checks_passed.text.erb b/app/views/teacher_mailer/initial_checks_passed.text.erb index 415252c30d..252c4ca3ff 100644 --- a/app/views/teacher_mailer/initial_checks_passed.text.erb +++ b/app/views/teacher_mailer/initial_checks_passed.text.erb @@ -4,7 +4,7 @@ Dear <%= application_form_full_name(@application_form) %> <%= render "shared/teacher_mailer/reference_number" %> -You should now request your <%= region_certificate_name(@application_form.region) %> from <%= region_teaching_authority_name(@application_form.region) %>. Contact them directly and instruct them to send the document to <%= t("service.email.verification") %>. +You should now request your <%= region_certificate_name(@application_form.region) %> from <%= region_teaching_authority_name(@application_form.region) %>. Contact them directly and instruct them to send the document to [<%= t("service.email.verification") %>](mailto:<%= t("service.email.verification") %>). Once we receive the document, we’ll begin the full assessment of your application. diff --git a/app/views/teacher_mailer/references_requested.text.erb b/app/views/teacher_mailer/references_requested.text.erb index 8adc9dc0ba..6bfca61f21 100644 --- a/app/views/teacher_mailer/references_requested.text.erb +++ b/app/views/teacher_mailer/references_requested.text.erb @@ -6,6 +6,6 @@ They need to respond by <%= @reference_requests.first.expires_at.to_date.to_fs(: Contact them to make sure they have received the request. They may need to check their junk email folder. -If they have not received the request, email QTS.Enquiries@education.gov.uk +If they have not received the request, email [<%= t("service.email.enquiries") %>](mailto:<%= t("service.email.enquiries") %>). <%= render "shared/teacher_mailer/footer" %> diff --git a/app/views/teaching_authority_mailer/application_submitted.text.erb b/app/views/teaching_authority_mailer/application_submitted.text.erb index 019106ac85..bad1259195 100644 --- a/app/views/teaching_authority_mailer/application_submitted.text.erb +++ b/app/views/teaching_authority_mailer/application_submitted.text.erb @@ -17,7 +17,7 @@ They’ve told us that they’re qualified to teach children <%= @application_fo We’d be grateful if you could provide written evidence of their professional standing as a teacher in <%= CountryName.from_region(@region, with_definite_article: true) %>, and email it to us at: -<%= t("service.email.verification") %> +[<%= t("service.email.verification") %>](mailto:<%= t("service.email.verification") %>) Please include their QTS application reference number <%= @application_form.reference %>. diff --git a/spec/mailers/teaching_authority_mailer_spec.rb b/spec/mailers/teaching_authority_mailer_spec.rb index c45e00da3e..ab79ca8dc6 100644 --- a/spec/mailers/teaching_authority_mailer_spec.rb +++ b/spec/mailers/teaching_authority_mailer_spec.rb @@ -81,7 +81,7 @@ We’d be grateful if you could provide written evidence of their professional standing as a teacher in Region Name, and email it to us at: -ApplyQTS.Verification@education.gov.uk +[ApplyQTS.Verification@education.gov.uk](mailto:ApplyQTS.Verification@education.gov.uk) Please include their QTS application reference number abc.