Add delete drafts form#2292
Merged
Merged
Conversation
DavidBiddle
approved these changes
Oct 27, 2025
Contributor
DavidBiddle
left a comment
There was a problem hiding this comment.
All looks good and I've tested it in the review environment 🎉
When deleting a draft, we check if the form is in a group to decide where to redirect the user to. This is left over from before groups were introduced. It's now no longer possible for a form to be created outside of a group. Users should always be redirected to the group page when deleting a draft.
Add a hint_text optional argument to the delete_confirmation_input partial.
Change the delete draft controller so that drafts can be deleted from forms which are in a live_with_draft state. We check use a different method to "delete" the draft from a live form and redirect to the live form page. We also redirect with a failure if this is called and the form is not a draft or a live_with_draft form.
Add a hint text to the delete draft live confirmation to help users understand that deleting a draft will not remove the live form.
When a live form has a draft, show the delete draft form button.
We don't offers users a link to the delete live forms. The end to end tests navigate directly to the URL to delete forms. This commit allows live forms to be deleted, preserving the original behaviour of end point.
69378ae to
ba1ccd2
Compare
|
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2292.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.



Add a delete draft button to live forms with draft
Trello card: https://trello.com/c/tP5Fd96d/2610-add-the-ability-to-delete-a-draft-of-a-live-form-with-a-confirmation-page
This PR replaces #2280 which was reverted in #2288. I reverted it because it prevented live forms being deleted, which the end to end tests rely on, even if it's not exposed to users.
The end-to-end tests delete forms after creating them to keep things tidy.
They manipulate the URL of a live form to directly navigate to the delete form page. At this point the form is a live state. The pages for deleting a form don't have content for deleting live forms so the tests check for the draft content.
I think we need to tidy this up. I'm going to raise another card to tackle this as it might need input from design and content or prioritising.
This PR adds a single new commit compared to the previous one. This commit allows live forms to be deleted as before and adds a comment why. Other than than nothing has changed. I've checked locally and the end to end tests pass with this change.
This PR allows users to revert draft forms to their live state. It only extends the current delete button controller to use the RevertDraftService when deleting forms in the live_with_draft_state.
It does a small amount of clean up and refactoring first.