Skip to content

Commit 01cdc5d

Browse files
committed
Ensure consented_vaccine_methods_message exists
This ensures that the variable is available in GOV.UK Notify even if it has no value. Specifically this is to handle non-flu programmes where we don't include this text content in the emails and texts. This fixes two Sentry issues: - https://good-machine.sentry.io/issues/6272173671/ - https://good-machine.sentry.io/issues/6235087330/
1 parent 9436104 commit 01cdc5d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

app/lib/govuk_notify_personalisation.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def consent_link
134134
end
135135

136136
def consented_vaccine_methods_message
137-
return if consent_form.nil? || consent_form.programmes.none?(&:flu?)
137+
return nil if consent_form.nil?
138+
return "" if consent_form.programmes.none?(&:flu?)
138139

139140
consent_form_programmes = consent_form.consent_form_programmes
140141

spec/lib/govuk_notify_personalisation_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,10 @@
206206

207207
it do
208208
expect(to_h).to include(
209+
consented_vaccine_methods_message: "",
210+
location_name: "Hogwarts",
209211
reason_for_refusal: "of personal choice",
210-
survey_deadline_date: "8 January 2024",
211-
location_name: "Hogwarts"
212+
survey_deadline_date: "8 January 2024"
212213
)
213214
end
214215

0 commit comments

Comments
 (0)