diff --git a/app/controllers/forms/redirect_from_forms_runner_controller.rb b/app/controllers/forms/redirect_from_forms_runner_controller.rb index fb80b775f..143612d2f 100644 --- a/app/controllers/forms/redirect_from_forms_runner_controller.rb +++ b/app/controllers/forms/redirect_from_forms_runner_controller.rb @@ -10,7 +10,12 @@ def edit_question def routes page_external_id = params.require(:page_external_id) page = current_form.pages.find_by!(external_id: page_external_id) - redirect_to show_routes_path(current_form.id, page.id) + + if FeatureService.new(group: current_form.group).enabled?(:multiple_branches) + redirect_to routes_path(current_form.id, anchor: page.page_position_id) + else + redirect_to show_routes_path(current_form.id, page.id) + end end private diff --git a/spec/requests/forms/redirect_from_forms_runner_controller_spec.rb b/spec/requests/forms/redirect_from_forms_runner_controller_spec.rb index 5aa994760..63c629391 100644 --- a/spec/requests/forms/redirect_from_forms_runner_controller_spec.rb +++ b/spec/requests/forms/redirect_from_forms_runner_controller_spec.rb @@ -81,8 +81,16 @@ expect(response).to have_http_status(302) end - it "redirects to the show routes page" do - expect(response).to redirect_to(show_routes_path(form_id: form.id, page_id: page.id)) + context "when the multiple branches feature is not enabled", feature_multiple_branches: false do + it "redirects to the show routes page" do + expect(response).to redirect_to(show_routes_path(form_id: form.id, page_id: page.id)) + end + end + + context "when the multiple branches feature is enabled", :feature_multiple_branches do + it "redirects to the edit routes page" do + expect(response).to redirect_to(routes_path(form_id: form.id, anchor: page.page_position_id)) + end end end