LG-11461 add FlowPolicy#undo_steps_from! and add to #update through document capture#9593
Merged
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 <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
matthinz
approved these changes
Nov 14, 2023
Co-authored-by: Matt Hinz <matt.hinz@gsa.gov>
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
Comment on lines
22
to
23
| controller_name = controller.ancestors.include?(ApplicationController) ? | ||
| controller.controller_name : controller |
Contributor
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
That works! Cool syntax, if a bit opaque. Updated.
Co-authored-by: Zach Margolis <zach.margolis@gsa.gov>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎫 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
#updatefor 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.