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.
This PR migrates authorization from Pundit to Action Policy.The original goal was to pass along error messages and redirection URLs forColdMessageController. But I'm not there yet – this PR only migrates the underlying system in place. (And adds a missing authorization!)While reviewing this PR I realized that my original expectation is a little flawed. A lot of the recent refactors, like the service layer one, stem from
ColdMessageControllerhaving what looks like a lot of logic.Migrating to Action Policy would allow us to pass error messages and "context" when an authorization fails. I was planning on using that to pass the redirection URL and a custom error message.
In hindsight, I think that's putting a little too much responsibility on the policy. For now I'm going to keep these changes that refactor some of the policies and use the view helper from Pundit.
Pull request checklist
bin/checkI added significant changes and product updates to the changelog