-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LG-11461 add FlowPolicy#undo_steps_from! and add to #update through document capture #9593
Conversation
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 <[email protected]> Co-authored-by: Sonia Connolly <[email protected]>
add to welcome controller #update
changelog: Internal, IdV Back Button, undo future steps
It gets the controller name with step.class, and then FlowPolicy can get the key from the controller name.
app/policies/idv/flow_policy.rb
Outdated
controller_name = controller.ancestors.include?(ApplicationController) ? | ||
controller.controller_name : controller |
There was a problem hiding this comment.
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
controller_name = controller.ancestors.include?(ApplicationController) ? | |
controller.controller_name : controller | |
controller_name = controller < ApplicationController ? | |
controller.controller_name : controller |
There was a problem hiding this comment.
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 <[email protected]>
🎫 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.