From 052a876f289322e3c8f4a8d940c154301b8f4781 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Sun, 28 Jul 2024 12:28:36 +0100 Subject: [PATCH 1/2] Regenerate slug when changing email address This is to ensure that the previous link stops working and old referees can't fill it in any more. --- app/services/update_work_history_contact.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/update_work_history_contact.rb b/app/services/update_work_history_contact.rb index dfe46a48b..996ace773 100644 --- a/app/services/update_work_history_contact.rb +++ b/app/services/update_work_history_contact.rb @@ -30,6 +30,8 @@ def call end if email.present? && (reference_request = work_history.reference_request) + reference_request.regenerate_slug + RequestRequestable.call( requestable: reference_request, user:, From b416ae9ce7a39152a898f1e25323fe39a17ca828 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Sun, 28 Jul 2024 12:52:54 +0100 Subject: [PATCH 2/2] Add error page for reference requests This adds some content that's shown if the reference request doesn't exist. --- .../teacher_interface/reference_requests_controller.rb | 6 ++++++ .../reference_requests/error_not_found.html.erb | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 app/views/teacher_interface/reference_requests/error_not_found.html.erb diff --git a/app/controllers/teacher_interface/reference_requests_controller.rb b/app/controllers/teacher_interface/reference_requests_controller.rb index a292c0d0f..facab93da 100644 --- a/app/controllers/teacher_interface/reference_requests_controller.rb +++ b/app/controllers/teacher_interface/reference_requests_controller.rb @@ -8,6 +8,8 @@ class ReferenceRequestsController < BaseController skip_before_action :authenticate_teacher! before_action :load_requested_reference_request, except: :show + rescue_from ActiveRecord::RecordNotFound, with: :error_not_found + define_history_origin :show define_history_reset :show define_history_check :edit @@ -25,6 +27,10 @@ def show @work_history = reference_request.work_history end + def error_not_found + render "error_not_found", status: :not_found + end + def edit @work_history = reference_request.work_history end diff --git a/app/views/teacher_interface/reference_requests/error_not_found.html.erb b/app/views/teacher_interface/reference_requests/error_not_found.html.erb new file mode 100644 index 000000000..2bc5e58c8 --- /dev/null +++ b/app/views/teacher_interface/reference_requests/error_not_found.html.erb @@ -0,0 +1,7 @@ +<% content_for :page_title, "We no longer need you to act as a reference." %> + +

<%= t("service.name.eligibility") %>

+ +

We no longer need you to act as a reference.

+ +

You do not need to do anything else.