Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6d80677
Implement copy form functionality with confirmation
davidjamesstone Nov 3, 2026
d73656c
Add tests for copy form routes including confirmation and redirection…
davidjamesstone Nov 3, 2026
1c86cd2
Add allowCopy option to form model for copy functionality
davidjamesstone Nov 3, 2026
ea1db22
Fix tests
davidjamesstone Nov 3, 2026
bdcfdae
Add tests for getSubmissionRecord in submission service
davidjamesstone Nov 3, 2026
9fa2347
Add tests for mapValueToState utility function
davidjamesstone Nov 3, 2026
95dd4e2
Sonar fixes (prefer node:crypto)
davidjamesstone Nov 3, 2026
ad2799c
Sonar fixes (prefer `.some(…)` over `.find(…)`)
davidjamesstone Nov 3, 2026
8c5b2e5
Sonar fixes (Dedupe)
davidjamesstone Nov 3, 2026
d4412aa
Sonar fixes (Dedupe)
davidjamesstone Nov 3, 2026
cb5abd2
Enhance type definitions and documentation for copy form functionality
davidjamesstone Nov 3, 2026
8ed5b48
Sonar fixes (Dedupe)
davidjamesstone Nov 3, 2026
e9ee58e
Add additional saved form to tests and update assertions for form count
davidjamesstone Nov 4, 2026
27c137e
Add session action for form copy and update output service tests
davidjamesstone Nov 4, 2026
61f4139
Merge branch 'main' into feature/DF-1206-reuse-answers-copy-action
davidjamesstone Nov 4, 2026
050fc35
Update form count assertion in homepage tests to reflect added saved …
davidjamesstone Nov 4, 2026
b16bb58
Merge branch 'main' into feature/DF-1206-reuse-answers-copy-action
davidjamesstone Nov 6, 2026
6e2b19b
Add confirmation page for copied answers
davidjamesstone Nov 9, 2026
add1673
Update URL for confirm copy form route to check answers
davidjamesstone Nov 9, 2026
3aeba1d
Refactor getTranslator function and update copyFormViewModel to impro…
davidjamesstone Nov 9, 2026
f621daa
Add tests for value mapping and string handling
davidjamesstone Nov 9, 2026
b6aac0b
Enhance copy form tests and add version metadata handling
davidjamesstone Nov 9, 2026
cb2d840
Update parameter type in escapeFileLabel function and add TypeScript …
davidjamesstone Nov 9, 2026
fbc4daa
Add Welsh translations for confirm copy check answers page
davidjamesstone Nov 9, 2026
bc1a02b
Refactor getTranslator function to clarify handling of preview status
davidjamesstone Nov 9, 2026
37f9ded
Add getPreviewStatus function to streamline preview status retrieval
davidjamesstone Nov 9, 2026
2eb6851
Refactor getTranslator calls to remove unused language parameter
davidjamesstone Nov 9, 2026
d12cefc
Refactor setCacheState to use getPreviewStatus for submission state
davidjamesstone Nov 9, 2026
d9a0587
Rename allowCopy to isAllowCopyEnabled for clarity in homepage logic
davidjamesstone Nov 9, 2026
4901d46
Remove unused parameter 'x' from OutputService submission method
davidjamesstone Nov 9, 2026
6ec491f
Update forms-model dependency to version 4.0.3 and refactor formRequi…
davidjamesstone Nov 9, 2026
cd91385
Remove unused escapeFileLabel function and related tests
davidjamesstone Nov 9, 2026
46d4ffc
Remove commented-out file handling logic from mapValueToState function
davidjamesstone Nov 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@aws-sdk/client-sns": "^3.1079.0",
"@defra/forms-common": "^0.1.6",
"@defra/forms-engine-plugin": "^5.0.0-alpha.34",
"@defra/forms-model": "^4.0.0",
"@defra/forms-model": "^4.0.3",
"@defra/hapi-tracing": "^1.30.0",
"@elastic/ecs-pino-format": "^1.5.0",
"@govuk-one-login/service-header": "^5.0.0",
Expand Down
13 changes: 12 additions & 1 deletion src/server/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@ export const SAVE_AND_EXIT_PAYLOAD = 'SAVE_AND_EXIT_PAYLOAD'
export const EN_GB = 'en-GB'
export const CY = 'cy'

// Keys for custom meta in form submission output
export const SESSION_ACTION = '__action'
export const SESSION_ACTION_REFERENCE_NUMBER = '__referenceNumber'

/**
* @type {{ Copy: 'copy' }}
*/
export const SessionActions = {
Copy: 'copy'
}

/**
* @type {{ Processing: 'processing', InProgress: 'inProgress', Submitted: 'submitted', Expired: 'expired', Deleted: 'deleted' }}
* @type {{ Processing: 'processing', InProgress: 'inProgress', Submitted: 'submitted', Expired: 'expired', Deleted: 'deleted' }}
*/
export const FormRowStatus = {
Processing: 'processing',
Expand Down
37 changes: 37 additions & 0 deletions src/server/i18n/translations/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
"actions": "Camau",
"continue": "Parhau",
"delete": "Dileu",
"copy": "Copïo",
"savedOn": "wedi'i gadw ar [[date]]"
},
"header": {
Expand Down Expand Up @@ -333,6 +334,42 @@
"confirmDeleteValidationMessage": "Dewiswch 'Iawn' i ddileu'r drafft neu 'Na' i'w gadw",
"successNotification": "Dileuwyd y drafft"
},
"confirmCopyForm": {
"title": "A ydych chi'n siŵr eich bod am gopïo'r atebion o'r ffurflen hon?",
"info1": "Byddwn yn defnyddio'r atebion o <strong>[[formTitle]]</strong> i gychwyn ffurflen newydd. Gallwch newid unrhyw un o'r atebion cyn i chi eu cyflwyno.",
"info2": "Ni fydd cyflwyniad y ffurflen hon yn cael ei newid na'i ddisodli.",
"formNameLabel": "Enw'r ffurflen",
"formSubmittedLabel": "Cyflwynwyd ar",
"formReferenceLabel": "Cyfeirnod",
"continueButton": "Copïo'r atebion",
"cancelButton": "Canslo"
},
"confirmCopyFormChanged": {
"title": "Eich cyflwyniad blaenorol",
"info1": "Mae'r ffurflen newydd hon yn seiliedig ar gyflwyniad blaenorol.",
"formNameLabel": "Enw'r ffurflen",
"formSubmittedLabel": "Cyflwynwyd ar",
"formReferenceLabel": "Cyfeirnod",
"subHeading": "Mae angen i chi ateb cwestiynau newydd",
"info2": "Ers i chi gyflwyno'r ffurflen hon ddiwethaf, mae rhai cwestiynau wedi newid neu mae angen i chi eu hateb eto.",
"info3": "Unwaith y byddwch wedi ateb y cwestiynau hyn, byddwch yn gallu:",
"info4": [
"adolygu eich holl atebion gyda'i gilydd",
"gwneud newidiadau os oes angen",
"cyflwyno'r ffurflen"
],
"continueButton": "Parhau",
"cancelButton": "Canslo"
},
"confirmCopyCheckAnswers": {
"title": "Cafodd yr atebion hyn eu copïo o'ch cyflwyniad blaenorol",
"formNameLabel": "Ffurflen",
"formReferenceLabel": "Rhif cyfeirnod blaenorol",
"info1": "Rydym wedi copïo eich atebion i'r ffurflen newydd hon. Ni fydd unrhyw newidiadau a wnewch yn effeithio ar eich cyflwyniad blaenorol.",
"info2": "Ar y dudalen nesaf, gallwch wirio a newid eich atebion cyn cyflwyno'r ffurflen.",
"continueButton": "Parhau",
"cancelButton": "Canslo"
},
"layout": {
"errorPrefix": "Gwall:",
"skipLink": "Neidio i'r prif gynnwys",
Expand Down
37 changes: 37 additions & 0 deletions src/server/i18n/translations/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
"actions": "Actions",
"continue": "Continue",
"delete": "Delete",
"copy": "Copy",
"savedOn": "saved on [[date]]"
},
"header": {
Expand Down Expand Up @@ -333,6 +334,42 @@
"confirmDeleteValidationMessage": "Select ‘Yes’ to delete the draft or ‘No’ to keep it",
"successNotification": "Draft deleted"
},
"confirmCopyForm": {
"title": "Are you sure you want to copy answers from this form?",
"info1": "We’ll use the answers from <strong>[[formTitle]]</strong> to start a new form. You can change any of the answers before you submit it.",
"info2": "This form submission will not be changed or replaced.",
"formNameLabel": "Form name",
"formSubmittedLabel": "Submitted on",
"formReferenceLabel": "Reference",
"continueButton": "Copy answers",
"cancelButton": "Cancel"
},
"confirmCopyFormChanged": {
"title": "Your previous submission",
"info1": "This new form is based on a previous submission.",
"formNameLabel": "Form name",
"formSubmittedLabel": "Submitted on",
"formReferenceLabel": "Reference",
"subHeading": "You need to answer new questions",
"info2": "Since you last submitted this form, some questions have changed or need to be answered again.",
"info3": "Once you’ve answered these questions, you’ll be able to:",
"info4": [
"review all your answers together",
"make changes if you need to",
"submit the form"
],
"continueButton": "Continue",
"cancelButton": "Cancel"
},
"confirmCopyCheckAnswers": {
"title": "These answers were copied from your previous submission",
"formNameLabel": "Form",
"formReferenceLabel": "Previous reference number",
"info1": "We’ve copied your answers into this new form. Any changes you make will not affect your previous submission.",
"info2": "On the next page, you can check and change your answers before submitting the form.",
"continueButton": "Continue",
"cancelButton": "Cancel"
},
"layout": {
"errorPrefix": "Error: ",
"skipLink": "Skip to main content",
Expand Down
2 changes: 2 additions & 0 deletions src/server/plugins/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { returnUrlSchema } from '~/src/server/models/common.js'
import { getErrorPreviewHandler } from '~/src/server/plugins/error-preview/error-preview.js'
import {
authRoutes,
copyFormRoutes,
deleteFormRoutes,
healthRoute,
homepageRoutes,
Expand Down Expand Up @@ -80,6 +81,7 @@ export default {
server.route(authRoutes as ServerRoute[])
server.route(homepageRoutes as ServerRoute[])
server.route(deleteFormRoutes as ServerRoute[])
server.route(copyFormRoutes as ServerRoute[])
}

server.route(routes)
Expand Down
Loading
Loading