diff --git a/app/controllers/questions/notification_preference_controller.rb b/app/controllers/questions/notification_preference_controller.rb index 46dc849696..b454307c0e 100644 --- a/app/controllers/questions/notification_preference_controller.rb +++ b/app/controllers/questions/notification_preference_controller.rb @@ -1,16 +1,9 @@ module Questions class NotificationPreferenceController < QuestionsController - before_action :returning_client_guard private def tracking_data @form.attributes_for(:intake).reject { |k, _| k == :sms_phone_number } end - - def returning_client_guard - if DuplicateIntakeGuard.new(current_intake).has_duplicate? - redirect_to returning_client_path - end - end end end diff --git a/app/controllers/questions/returning_client_controller.rb b/app/controllers/questions/returning_client_controller.rb index 9c0a0a4b62..4b7607f76d 100644 --- a/app/controllers/questions/returning_client_controller.rb +++ b/app/controllers/questions/returning_client_controller.rb @@ -1,5 +1,15 @@ module Questions class ReturningClientController < QuestionsController layout "application" + + def self.show?(intake) + DuplicateIntakeGuard.new(intake).has_duplicate? + end + + private + + def form_class + NullForm + end end end diff --git a/app/lib/question_navigation.rb b/app/lib/question_navigation.rb index 1a4f71f39d..5f41153a5b 100644 --- a/app/lib/question_navigation.rb +++ b/app/lib/question_navigation.rb @@ -5,7 +5,7 @@ class QuestionNavigation Questions::FileWithHelpController, Questions::AlreadyFiledController, Questions::FilingForStimulusController, - Questions::StimulusRecommendationController, #possible off-boarding from flow + Questions::StimulusRecommendationController, # possible off-boarding from flow Questions::BacktaxesController, Questions::StartWithCurrentYearController, @@ -20,6 +20,7 @@ class QuestionNavigation Questions::ChatWithUsController, Questions::PhoneNumberController, Questions::EmailAddressController, + Questions::ReturningClientController, # possible off-boarding from flow Questions::NotificationPreferenceController, # Consent diff --git a/app/views/questions/returning_client/show.html.erb b/app/views/questions/returning_client/edit.html.erb similarity index 100% rename from app/views/questions/returning_client/show.html.erb rename to app/views/questions/returning_client/edit.html.erb diff --git a/config/routes.rb b/config/routes.rb index ebd98d396f..53415e4721 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -62,7 +62,6 @@ post "/:organization/drop-offs", to: "intake_site_drop_offs#create", as: :create_drop_off get "/:organization/drop-off/:id", to: "intake_site_drop_offs#show", as: :show_drop_off - get "/returning-client", to: "questions/returning_client#show" get "/identity-needed", to: "offboarding#identity_needed" get "/other-options", to: "public_pages#other_options" get "/maybe-ineligible", to: "public_pages#maybe_ineligible" diff --git a/spec/features/web_intake/returning_filer_spec.rb b/spec/features/web_intake/returning_filer_spec.rb index 30bf6735e8..4c5207aef8 100644 --- a/spec/features/web_intake/returning_filer_spec.rb +++ b/spec/features/web_intake/returning_filer_spec.rb @@ -9,7 +9,7 @@ ) end - scenario "returning client tries filing again taken to signpost page", :js do + scenario "returning client tries filing again is taken to returning client signpost page" do visit already_filed_questions_path click_on "Yes" @@ -19,7 +19,7 @@ fill_in "Confirm e-mail address", with: "returning@client.com" click_on "Continue" - expect(current_path).to eq(returning_client_path) + expect(current_path).to eq(returning_client_questions_path) click_on("Return to home") expect(current_path).to eq(root_path) end diff --git a/spec/helpers/duplicate_intake_guard_spec.rb b/spec/helpers/duplicate_intake_guard_spec.rb index c80ff98820..1831bd9333 100644 --- a/spec/helpers/duplicate_intake_guard_spec.rb +++ b/spec/helpers/duplicate_intake_guard_spec.rb @@ -25,6 +25,7 @@ expect(subject).to have_duplicate end end + context "intake with matching phone number exists" do let!(:existing_intake) { create(:intake, phone_number: "1234567890") } let(:matching_intake) { create(:intake, phone_number: "1234567890") }