Skip to content

Commit

Permalink
Re-enable 1990e confirmation emails to authenticated users (#12970)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanbwright authored Jun 13, 2023
1 parent 0617c62 commit 9ea6846
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/models/saved_claim/education_benefits/va_1990e.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ class SavedClaim::EducationBenefits::VA1990e < SavedClaim::EducationBenefits
def after_submit(user)
return unless Flipper.enabled?(:form1990e_confirmation_email)

# only sending to unauthenticated users at this time
return if user.present?
if Flipper.enabled?(:form1990e_auth_confirmation_email)
# allow for phased rollout of authenticated users
elsif user.present?
# skip sending to authenticated users
return
end

parsed_form_data ||= JSON.parse(form)
email = parsed_form_data['email']
Expand Down
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ features:
actor_type: user
description: Enables form 1990 email submission confirmation for authenticated users (VaNotify)
enable_in_development: true
form1990e_auth_confirmation_email:
actor_type: user
description: Enables form 1990 email submission confirmation for authenticated users (VaNotify)
enable_in_development: true
form1995_confirmation_email:
actor_type: user
description: Enables form 1995 email submission confirmation (VaNotify)
Expand Down
13 changes: 12 additions & 1 deletion spec/models/saved_claim/education_benefits/va1990e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@
let(:user) { create(:user) }

describe 'confirmation email for the 1990e' do
it 'is skipped when user is present' do
it 'is skipped when user is present and feature flag is turned off' do
Flipper.disable(:form1990e_auth_confirmation_email)
allow(VANotify::EmailJob).to receive(:perform_async)

subject = create(:va1990e_with_email)
subject.after_submit(user)

expect(VANotify::EmailJob).not_to have_received(:perform_async)
Flipper.enable(:form1990e_auth_confirmation_email)
end

it 'is enabled when user is present and feature flag is turned on' do
allow(VANotify::EmailJob).to receive(:perform_async)

subject = create(:va1990e_with_email)
subject.after_submit(user)

expect(VANotify::EmailJob).to have_received(:perform_async)
end

it 'sends if no user is present' do
Expand Down

0 comments on commit 9ea6846

Please sign in to comment.