Merged
Conversation
admmediaconsulting
approved these changes
Nov 3, 2025
Member
|
@admmediaconsulting Do you have a particular interest in this? I'm not quite clear how you ended up being a reviewer on this PR. |
marcusmoore
approved these changes
Nov 4, 2025
database/migrations/2025_10_22_144927_migrate_incorrect_action_types.php
Outdated
Show resolved
Hide resolved
Comment on lines
+341
to
+344
| if (is_string($actiontype)) { | ||
| $actiontype = ActionType::from($actiontype); | ||
| } | ||
| $this->action_type = $actiontype->value; |
Collaborator
There was a problem hiding this comment.
I like that we're keeping the existing behavior around (passing in a string) while also checking that the string is a valid type using ::from 👍🏾
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.
This is yet another attempt to re-add the ActionType enum in the least invasive way that I can manage. The
logaction()method now has a more complex function signature, allowing either a string or an ActionType. If it's a string, it's turned into an ActionType by using the baked-in::from()method of the backed-enum, which will ensure that only valid ActionTypes are permitted - the::from()method will throw an error if you use a string that cannot be converted back into an ActionType.In the process of working with this, I did discover one place that was using
request_canceledinstead ofrequest canceledso I've also added a migration to fix this in the actionlog table (and fixed the code for this going forward). It's still a little bit scary in that it will iterate through the entire actionlog table, but luckily we're already indexed on theaction_typecolumn, so the migration should complete very quickly. I also found a place where we saidnote_addedinstead ofnote addedso I fixed that as well.It's tempting to go through and change every instance where we use
logaction()to pass in the appropriate ActionType enum - but that's going to cause too many changes to the code-base, all at once - which we're trying to avoid. This approach still means we get the safety of the Enum, without having to change all of the entire codebase.