Add forms specific base controller#2607
Merged
stephencdaly merged 3 commits intomainfrom Mar 10, 2026
Merged
Conversation
This action is performed when a post request is made to the /pages routes, so it makes sense to exist in the PagesController.
This controller is now only responsible for rendering the draft form page. Rename it to reflect this, and move it into the Forms namespace for consistency.
Move form-specific methods from WebController into a new FormsController which all controllers that handle ations related to an individual form inherit from. We need to add a new form-specific after_action and don't want to further pollute WebController with form-specific code. Move the verify_authorized after_action to the FormsController to avoid duplication and to ensure that all form-related controllers have authorisation checks.
a8ed704 to
efd1b56
Compare
|
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2607.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
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.



What problem does this pull request solve?
Trello card: https://trello.com/c/vnpXef5W
We need to add a new form-specific after_action to the base controller to send emails to organisation admins when a draft is made of an existing form. This needs to apply to all controllers that can edit a form, as we create a draft when a change is first made to a form rather then when a specific action is performed, and we need to send the email from the controller so that we know the identity of the current user.
We don't want to further pollute WebController with form-specific code, so add a new FormsController base controller that all controllers that handle ations related to an individual form inherit from.
There was an existing controller named FormsController which has been renamed to Forms::DraftController to better describe what it does.
Things to consider when reviewing