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.