Skip to content

Copy of answers#2113

Merged
chao-xian merged 13 commits into
mainfrom
copy-of-answers
Jun 9, 2026
Merged

Copy of answers#2113
chao-xian merged 13 commits into
mainfrom
copy-of-answers

Conversation

@chao-xian

@chao-xian chao-xian commented May 22, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Updates the flow for Copy Of Answers feature and switches from a global feature flag to checking against a value set on the form whether to show that feature to the form filler.

Trello card: https://trello.com/c/KZuqH0bA

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?

@chao-xian chao-xian marked this pull request as ready for review June 3, 2026 12:45

@stephencdaly stephencdaly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a bunch of style comments, it's up to you if you want to make the suggested changes for these.

The things that we should change are:

  • We need a test for when the send_copy_of_answers isn't present on the form document to prevent regressions.
  • We shouldn't show the extra section on the check your answers page if send_copy_of_answers is disabled for the form.
  • The Welsh translations should have curly quotes

Comment thread spec/models/form_spec.rb
Comment thread app/models/form.rb
Comment thread spec/requests/forms/step_controller_spec.rb
Comment thread spec/requests/forms/step_controller_spec.rb Outdated
Comment thread spec/requests/forms/check_your_answers_controller_spec.rb Outdated
Comment thread app/views/forms/check_your_answers/show.html.erb Outdated
Comment thread spec/views/forms/check_your_answers/show.html.erb_spec.rb Outdated
Comment thread spec/requests/forms/check_your_answers_controller_spec.rb
Comment thread app/views/forms/submitted/submitted.html.erb Outdated
Comment thread app/controllers/forms/check_your_answers_controller.rb Outdated
Comment thread app/views/forms/check_your_answers/show.html.erb Outdated
@chao-xian chao-xian force-pushed the copy-of-answers branch 3 times, most recently from 2c6af57 to 0e48db2 Compare June 9, 2026 13:01
Comment thread spec/models/form_spec.rb

@stephencdaly stephencdaly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes now work as expected. We just need to add a test to form_spec.rb for when the field is missing from the form document.

The Welsh translations haven't been updated to use curly quotes - you should just be able to apply my suggestions using the "Add suggestion batch" button on the comments to put them all in one commit.

@stephencdaly stephencdaly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good now, thanks for making those changes!

chao-xian and others added 13 commits June 9, 2026 16:00
A new attribute has been added to Forms. It allows editors to set whether fillers get to see the CopyOfAnswers page on their form.
We don't just want to show the page on checking the feature flag, but also if it's allowed for the form itself anyway.
To also check that the form itself is meant to show the Copy Of Answers page.
The feature is now controlled by the form's
send_copy_of_answers attribute rather than a global feature flag.
Switches from a plain text body key to body_html so the multi-paragraph explanation of the One Login journey can be rendered correctly.
When a user has already opted in to a copy of answers via One Login
and we have their email address, the CYA page no longer shows the
separate confirmation email radio buttons. Instead it shows a summary
of their copy-of-answers choice with a change link, and the form
submits with send_confirmation: "skip_confirmation" implicitly.

Also removes the remaining FeatureService check from back_link.
When the user opted in via One Login and we have their email, display
a specific "we've sent a copy of your answers" message rather than the
generic confirmation email message.
…s is chosen

This is the first step to refactoring, as we are doing too much logic in too many places for this check.
Co-authored-by: Stephen Daly <stephen.daly@digital.cabinet-office.gov.uk>
@chao-xian chao-xian enabled auto-merge June 9, 2026 15:01
@chao-xian chao-xian added this pull request to the merge queue Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2113.submit.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.

Merged via the queue into main with commit 17b71d6 Jun 9, 2026
3 checks passed
@chao-xian chao-xian deleted the copy-of-answers branch June 9, 2026 15:20
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.

2 participants