Skip to content

Commit 427aa7e

Browse files
authored
Merge pull request #3948 from nhsuk/notify-log-previous-template-ids
Ensure we have names for unused Notify templates
2 parents 63b04ed + c89aa7f commit 427aa7e

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

app/models/notify_log_entry.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def title
6565
private
6666

6767
def template_name
68-
if email?
68+
if GOVUK_NOTIFY_UNUSED_TEMPLATES.include?(template_id)
69+
GOVUK_NOTIFY_UNUSED_TEMPLATES.fetch(template_id)
70+
elsif email?
6971
GOVUK_NOTIFY_EMAIL_TEMPLATES.key(template_id)
7072
elsif sms?
7173
GOVUK_NOTIFY_SMS_TEMPLATES.key(template_id)

config/initializers/govuk_notify.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,25 @@
4545
vaccination_administered: "395a3ea1-df07-4dd6-8af1-64cc597ef383",
4646
vaccination_not_administered: "aae061e0-b847-4d4c-a87a-12508f95a302"
4747
}.freeze
48+
49+
# Here we track email and SMS templates that we used to send but no longer
50+
# do. We need these to be able to display the names of the templates.
51+
GOVUK_NOTIFY_UNUSED_TEMPLATES = {
52+
"16ae7602-c2b1-4731-bb74-fd4f1357feca" => :vaccination_administered_menacwy,
53+
"25473aa7-2d7c-4d1d-b0c6-2ac492f737c3" => :consent_confirmation_given,
54+
"4c616b22-eee8-423f-84d6-bd5710f744fd" => :vaccination_administered_td_ipv,
55+
"55d35c86-7365-406b-909f-1b7b78529ea8" =>
56+
:consent_school_subsequent_reminder_doubles,
57+
"604ee667-c996-471e-b986-79ab98d0767c" => :consent_confirmation_triage,
58+
"6410145f-dac1-46ba-82f3-a49cad0f66a6" =>
59+
:consent_school_subsequent_reminder_hpv,
60+
"69612d3a-d6eb-4f04-8b99-ed14212e7245" => :vaccination_administered_hpv,
61+
"6aa04f0d-94c2-4a6b-af97-a7369a12f681" => :consent_school_request_hpv,
62+
"79e131b2-7816-46d0-9c74-ae14956dd77d" => :session_school_reminder,
63+
"7cda7ae5-99a2-4c40-9a3e-1863e23f7a73" => :consent_confirmation_given,
64+
"8835575d-be69-442f-846e-14d41eb214c7" =>
65+
:consent_school_initial_reminder_doubles,
66+
"ceefd526-d44c-4561-b0d2-c9ef4ccaba4f" =>
67+
:consent_school_initial_reminder_hpv,
68+
"e9aa7f0f-986f-49be-a1ee-6d1d1c13e9ec" => :consent_school_request_doubles
69+
}.freeze

spec/models/notify_log_entry_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,17 @@
7070

7171
it { should eq("Unknown SMS") }
7272
end
73+
74+
context "with a template no longer in use" do
75+
let(:notify_log_entry) do
76+
build(
77+
:notify_log_entry,
78+
:email,
79+
template_id: "25473aa7-2d7c-4d1d-b0c6-2ac492f737c3"
80+
)
81+
end
82+
83+
it { should eq("Consent confirmation given") }
84+
end
7385
end
7486
end

0 commit comments

Comments
 (0)