Skip to content

LG-11461 add FlowPolicy#undo_steps_from! and add to #update through document capture#9593

Merged
theabrad merged 12 commits intomainfrom
abrad-lg-11461-invalidate-steps
Nov 15, 2023
Merged

LG-11461 add FlowPolicy#undo_steps_from! and add to #update through document capture#9593
theabrad merged 12 commits intomainfrom
abrad-lg-11461-invalidate-steps

Conversation

@theabrad
Copy link
Contributor

@theabrad theabrad commented Nov 14, 2023

🎫 Ticket

LG-11461

🛠 Summary of changes

This is an addition to #9589 to invalidate future steps when a user uses the back button and submits a previous step. We added the new call to #update for welcome, agreement, link_sent, hybrid_handoff, how_to_verify, phone_question, and document_capture.

Each step_info now has an undo_step parameter which is a proc that unsets whatever the current step sets.

FlowPolicy has a new method, undo_steps_from! which recursively undoes all of the next steps after the current step.

IdvStepConcern has a new helper method clear_invalid_steps! that should be called at the beginning of the #update method of each IdV controller that allows the back button.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Start IdV
  • Go up to document capture
  • Use the back button to go back to the welcome step
  • Submit welcome
  • Expect agreement box to be unchecked

theabrad and others added 5 commits November 14, 2023 16:14
Added to FlowPolicy :undo_step_from which invalidates all of the next
steps in the flow if a user clicks submit after using the back button.

Co-authored-by: Doug Price <douglas.price@gsa.gov>
Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov>
add to welcome controller #update
changelog: Internal, IdV Back Button, undo future steps
@theabrad theabrad requested review from a team and matthinz November 14, 2023 22:10
It gets the controller name with step.class, and then FlowPolicy can
get the key from the controller name.
Comment on lines 22 to 23
controller_name = controller.ancestors.include?(ApplicationController) ?
controller.controller_name : controller
Copy link
Contributor

Choose a reason for hiding this comment

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

is controller a Class or an instance?

If it's a Class we can do < to check subclass instead of iterating ancestors

Suggested change
controller_name = controller.ancestors.include?(ApplicationController) ?
controller.controller_name : controller
controller_name = controller < ApplicationController ?
controller.controller_name : controller

Copy link
Contributor

Choose a reason for hiding this comment

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

That works! Cool syntax, if a bit opaque. Updated.

Co-authored-by: Zach Margolis <zach.margolis@gsa.gov>
@theabrad theabrad merged commit 19e387c into main Nov 15, 2023
@theabrad theabrad deleted the abrad-lg-11461-invalidate-steps branch November 15, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants