Add persistent DonationProcessAction history for processing pages #559
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.
Contributing to the Donation Tracker
First of all, thank you for taking the time to contribute!
Please fill out the template below and check the following boxes:
Description of the Change
Especially at peak times, donation processors are quickly taking actions on many donations, and it's entirely possible for misclicks or unintended actions to occur. While it's possible to undo actions through the Admin dashboards, that's out of the way and not always intuitive to do, especially if the processor can't remember exactly what they did in the first place.
To address that, the initial version of the new Process Donations page included a naive "Action History" section in the sidebar that held a local list of actions that the processor had taken, and a basic "undo" button to reset the donation to a fully pending state. This worked, but wasn't really helpful because it disappeared whenever you reloaded the page, always reset to "UNPROCESSED" (even in the confirm mode, where it should be reset to "FLAGGED"), and only worked with actions taken on the local page (two pages open would have different histories).
This PR introduces a backend-persisted model for donation processing actions that tracks who performed an action, the source and target states, and also tracks undos using an
originating_action
. These actions are sent as part of thebroadcast_processing_action
socket updates, and are also queryable and undoable through their own API endpoints.On the frontend, the action history has now moved to a distinct modal to better handle longer histories and provide more information to reference when deciding to undo an action.
Verification Process
Added tests. Ensured that performing actions in all of the states on the frontend logged an appropriate action, and that undoing actions put donations back into the appropriate states (and generates a new Undo action record as well).
The action history should be visible across page reloads, and on both the Processing and Read donations pages.