Reset checkout to value when navigating away from type #13597
Merged
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.
(what a terrible PR name)
Description
Currently when creating or cloning an asset it is possible to submit bad data about the check out via these inputs:
As an example, clicking Location, picking a location, going back to User, then submitting, sends the following to the server (notice that
assigned_location
is still populated):Example showing the steps to recreate:
CleanShot.2023-09-13.at.14.07.41.mp4
With this PR the
assigned_x
fields are nulled out:Be aware that this now means that users clicking "Location", selecting a location, clicking away and then back, will have the selected Location removed:
CleanShot.2023-09-13.at.13.15.41.mp4
I also updated the
CheckoutableListener
to make sure the model that was checked out to has therouteNotificationFor()
method on it (provided by theNotifiable
trait). This should ensure we don't have anymoreException caught during checkout notification: Call to undefined method App\Models\Location::routeNotificationFor()
showing up in logs.Type of change