Skip to content

Commit

Permalink
Omit nil key-value pair in email personalization (#19890)
Browse files Browse the repository at this point in the history
* omit key-value pair in personalization where appropriate

* specs
  • Loading branch information
Thrillberg authored Dec 16, 2024
1 parent f61aea9 commit 6a533ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ def get_first_name_from_user

def get_personalization(first_name)
if @form_number.start_with? 'vba_21_0966'
default_personalization(first_name).merge(form21_0966_personalization)
personalization = default_personalization(first_name).merge(form21_0966_personalization)
personalization.except!('lighthouse_updated_at') unless lighthouse_updated_at
personalization
else
default_personalization(first_name)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,6 @@
'first_name' => 'Veteran',
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
'confirmation_number' => confirmation_number,
'lighthouse_updated_at' => nil,
'intent_to_file_benefits' => 'survivors pension benefits',
'intent_to_file_benefits_links' => '[Apply for DIC, Survivors Pension, and/or Accrued Benefits ' \
'(VA Form 21P-534EZ)](https://www.va.gov/find-forms/about-form-21p-534ez/)',
Expand All @@ -942,7 +941,6 @@
'first_name' => 'Veteran',
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
'confirmation_number' => confirmation_number,
'lighthouse_updated_at' => nil,
'intent_to_file_benefits' => 'survivors pension benefits',
'intent_to_file_benefits_links' => '[Apply for DIC, Survivors Pension, and/or Accrued Benefits ' \
'(VA Form 21P-534EZ)](https://www.va.gov/find-forms/about-form-21p-534ez/)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@
end

describe '21_0966' do
let(:lighthouse_updated_at) { 1.day.ago }
let(:date_submitted) { Time.zone.today.strftime('%B %d, %Y') }
let(:data) do
fixture_path = Rails.root.join(
Expand All @@ -794,7 +795,7 @@
end
let(:config) do
{ form_data: data, form_number: 'vba_21_0966',
confirmation_number: 'confirmation_number', date_submitted: }
confirmation_number: 'confirmation_number', date_submitted:, lighthouse_updated_at: }
end
let(:user) { create(:user, :loa3) }

Expand All @@ -812,7 +813,7 @@
'first_name' => 'Veteran',
'date_submitted' => date_submitted,
'confirmation_number' => 'confirmation_number',
'lighthouse_updated_at' => nil,
'lighthouse_updated_at' => lighthouse_updated_at,
'intent_to_file_benefits' => 'survivors pension benefits',
'intent_to_file_benefits_links' => '[Apply for DIC, Survivors Pension, and/or Accrued Benefits ' \
'(VA Form 21P-534EZ)](https://www.va.gov/find-forms/about-form-21p-534ez/)',
Expand Down Expand Up @@ -841,7 +842,7 @@
'first_name' => 'I',
'date_submitted' => date_submitted,
'confirmation_number' => 'confirmation_number',
'lighthouse_updated_at' => nil,
'lighthouse_updated_at' => lighthouse_updated_at,
'intent_to_file_benefits' => 'survivors pension benefits',
'intent_to_file_benefits_links' => '[Apply for DIC, Survivors Pension, and/or Accrued Benefits ' \
'(VA Form 21P-534EZ)](https://www.va.gov/find-forms/about-form-21p-534ez/)',
Expand Down Expand Up @@ -884,7 +885,6 @@
'first_name' => 'Veteran',
'date_submitted' => date_submitted,
'confirmation_number' => 'confirmation_number',
'lighthouse_updated_at' => nil,
'intent_to_file_benefits' => 'survivors pension benefits',
'intent_to_file_benefits_links' => '[Apply for DIC, Survivors Pension, and/or Accrued Benefits ' \
'(VA Form 21P-534EZ)](https://www.va.gov/find-forms/about-form-21p-534ez/)',
Expand Down Expand Up @@ -913,7 +913,6 @@
'first_name' => 'I',
'date_submitted' => date_submitted,
'confirmation_number' => 'confirmation_number',
'lighthouse_updated_at' => nil,
'intent_to_file_benefits' => 'survivors pension benefits',
'intent_to_file_benefits_links' => '[Apply for DIC, Survivors Pension, and/or Accrued Benefits ' \
'(VA Form 21P-534EZ)](https://www.va.gov/find-forms/about-form-21p-534ez/)',
Expand Down

0 comments on commit 6a533ba

Please sign in to comment.