Skip to content

Add exit pages update delete - #3024

Open
thomasiles wants to merge 9 commits into
mainfrom
add-exit-pages-update-delete
Open

Add exit pages update delete#3024
thomasiles wants to merge 9 commits into
mainfrom
add-exit-pages-update-delete

Conversation

@thomasiles

@thomasiles thomasiles commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/gecvdskV/3173-change-add-edit-delete-exit-page-to-work-with-multiple-branches

Add the update/delete exit page routes and make a few small improvements to the add exit page:

  • only allow exit pages to be added to selection questions
  • update the form to show questions have changed when changes are made to exit pages
image image

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

When making changes to some models, we want to reset the
question_section_completed flag and update the draft.

We do this in some places by calling save_question_changes! after making
the changes.

To make this more consistent, we can add an optional block to
save_question_changes! which will be called in the same transaction as
the save.

This allows us to pass our changes in a block and be sure the draft is
updated.

diff --git a/app/models/form.rb b/app/models/form.rb
index 22cf9c7..7dc3f9c 100644
--- a/app/models/form.rb
+++ b/app/models/form.rb
@@ -51,11 +51,18 @@ class Form < ApplicationRecord

   attr_accessor :task_status_service
Creating a new exit page should create a new draft and set the
question_section_completed flag to false.
ExitPages should only be added to pages that have selection options.

This commit adds a before_action to check that the page can have exit
pages before allowing the user to add, edit or delete them.

If the shouldn't have exit pages, the user is redirected to a 404 page.

The actions are ordered so that the permission check is first, followed
by the others.
@thomasiles
thomasiles force-pushed the add-exit-pages-update-delete branch from 50535c8 to e605106 Compare August 13, 2026 15:03
@github-actions

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-3024.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
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@thomasiles
thomasiles marked this pull request as ready for review August 13, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant