Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/controllers/idv/phone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class PhoneController < ApplicationController
before_action :set_idv_form

def new
if params[:step]
analytics.track_event(Analytics::IDV_PHONE_USE_DIFFERENT, step: params[:step])
end

redirect_to failure_url(:fail) and return if throttle.throttled?

async_state = step.async_state
Expand Down
4 changes: 3 additions & 1 deletion app/presenters/idv/otp_verification_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def phone_number_message
end

def update_phone_link
phone_path = Rails.application.routes.url_helpers.idv_phone_path
phone_path = Rails.application.routes.url_helpers.idv_phone_path(
step: 'phone_otp_verification',
)
link = link_to(t('forms.two_factor.try_again'), phone_path)
t('instructions.mfa.wrong_number_html', link: link)
end
Expand Down
1 change: 1 addition & 0 deletions app/services/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def browser_attributes
IDV_PHONE_CONFIRMATION_OTP_VISIT = 'IdV: phone confirmation otp visited'.freeze
IDV_PHONE_OTP_DELIVERY_SELECTION_SUBMITTED = 'IdV: Phone OTP Delivery Selection Submitted'.freeze
IDV_PHONE_OTP_DELIVERY_SELECTION_VISIT = 'IdV: Phone OTP delivery Selection Visited'.freeze
IDV_PHONE_USE_DIFFERENT = 'IdV: use different phone number'.freeze
IDV_PHONE_RECORD_VISIT = 'IdV: phone of record visited'.freeze
IDV_REVIEW_COMPLETE = 'IdV: review complete'.freeze
IDV_REVIEW_VISIT = 'IdV: review info visited'.freeze
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/otp_delivery_method/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
heading: t('idv.troubleshooting.headings.having_trouble'),
options: [
{
url: idv_phone_path,
url: idv_phone_path(step: 'phone_otp_delivery_selection'),
text: t('idv.troubleshooting.options.change_phone_number'),
},
gpo_letter_available && {
Expand Down
17 changes: 17 additions & 0 deletions spec/controllers/idv/phone_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@
end
end

context 'when the user has chosen to use a different number' do
let(:step) { 'path_where_user_asked_to_use_different_number' }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Not a path anymore.

Suggested change
let(:step) { 'path_where_user_asked_to_use_different_number' }
let(:step) { 'step_where_user_asked_to_use_different_number' }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I caught that, too! 😄

let(:params) { { step: step } }

before do
stub_analytics
allow(@analytics).to receive(:track_event)
end

it 'logs an event showing that the user wants to choose a different number' do
get :new, params: params

expect(@analytics).to have_received(:track_event).
with(Analytics::IDV_PHONE_USE_DIFFERENT, step: step)
end
end

it 'shows phone form if async process times out and allows successful resubmission' do
stub_analytics
allow(@analytics).to receive(:track_event)
Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/steps/phone_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
click_link t('forms.two_factor.try_again')

expect(page).to have_content(t('idv.titles.session.phone'))
expect(page).to have_current_path(idv_phone_path)
expect(page).to have_current_path(idv_phone_path(step: 'phone_otp_verification'))

fill_out_phone_form_ok(second_phone_number)
click_idv_continue
Expand Down