From f1c04251a8aa8c99b6f1e274ee85c6942a1d8f6b Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 20 Oct 2023 12:07:09 +0100 Subject: [PATCH] Add a case reference to data breach form Add a unique case reference to the data breach form to prevent incorrect threading by GMail. Requires https://github.com/mysociety/alaveteli/pull/7967 Fixes https://github.com/mysociety/whatdotheyknow-theme/issues/1774 --- lib/data_breach.rb | 3 ++- spec/integration/report_a_data_breach_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/data_breach.rb b/lib/data_breach.rb index 88e3d087..b41a8bde 100644 --- a/lib/data_breach.rb +++ b/lib/data_breach.rb @@ -63,7 +63,8 @@ def data_breach(report, logged_in_user) mail( from: from, to: contact_from_name_and_email, - subject: _('New data breach report'), + subject: _('New data breach report [{{reference}}]', + reference: case_reference('BR')) ) end end diff --git a/spec/integration/report_a_data_breach_spec.rb b/spec/integration/report_a_data_breach_spec.rb index 5692e2b0..1a55fc64 100644 --- a/spec/integration/report_a_data_breach_spec.rb +++ b/spec/integration/report_a_data_breach_spec.rb @@ -36,7 +36,7 @@ last_email = ActionMailer::Base.deliveries.last expect(last_email.from).to eq(['do-not-reply-to-this-address@localhost']) expect(last_email.to).to eq(['postmaster@localhost']) - expect(last_email.subject).to eq('New data breach report') + expect(last_email.subject).to match(/New data breach report \[BR\/.*\]/) expect(last_email.header["Reply-To"].value).to eq('test@example.com') expect(last_email.body).to include('URL: https://example.com') expect(last_email.body).to include('Special category or criminal offence data: Yes')