Skip to content

Commit

Permalink
Disable user profile email in form 40-0247
Browse files Browse the repository at this point in the history
  • Loading branch information
ianperera committed Mar 6, 2024
1 parent 538ae1e commit 691eff1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def form_specific_data
when 'vba_40_0247'
return unless Flipper.enabled?(:form40_0247_confirmation_email)

form40_0247_contact_info(@form_data)
[@form_data['applicant_email'], @form_data.dig('applicant_full_name', 'first')]
else
[nil, nil]
end
Expand Down Expand Up @@ -131,11 +131,5 @@ def form21_10210_contact_info(form_data)
[nil, nil]
end
end

def form40_0247_contact_info(form_data)
# email address is optional field
# when email is not entered, use current user's email
[form_data['applicant_email'].presence || @user&.va_profile_email, form_data.dig('applicant_full_name', 'first')]
end
end
end
12 changes: 2 additions & 10 deletions modules/simple_forms_api/spec/services/confirmation_email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
context 'when user is signed in' do
let(:user) { create(:user, :loa3) }

it 'sends the confirmation email' do
it 'does not send the confirmation email' do
allow(VANotify::EmailJob).to receive(:perform_async)
expect(data['applicant_email']).to be_nil

Expand All @@ -157,15 +157,7 @@

subject.send

expect(VANotify::EmailJob).to have_received(:perform_async).with(
user.va_profile_email,
'form40_0247_confirmation_email_template_id',
{
'first_name' => 'JOE',
'date_submitted' => Time.zone.today.strftime('%B %d, %Y'),
'confirmation_number' => 'confirmation_number'
}
)
expect(VANotify::EmailJob).not_to have_received(:perform_async)
end
end

Expand Down

0 comments on commit 691eff1

Please sign in to comment.