Skip to content

Commit d18a89e

Browse files
authored
Merge pull request #8812 from opengovsg/release_v6.257.0
build: release v6.257.0
2 parents c60a7be + cd46488 commit d18a89e

File tree

14 files changed

+591
-63
lines changed

14 files changed

+591
-63
lines changed

CHANGELOG.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v6.257.0](https://github.com/opengovsg/FormSG/compare/v6.256.0...v6.257.0)
8+
9+
- feat: duplicate form workflow and override emails [`#8799`](https://github.com/opengovsg/FormSG/pull/8799)
10+
- build: merge release v6.256.0 to develop [`#8808`](https://github.com/opengovsg/FormSG/pull/8808)
11+
- build: release v6.256.0 [`#8807`](https://github.com/opengovsg/FormSG/pull/8807)
12+
713
#### [v6.256.0](https://github.com/opengovsg/FormSG/compare/v6.255.0...v6.256.0)
814

15+
> 9 October 2025
16+
917
- fix: revert signatures v1.4 [`#8805`](https://github.com/opengovsg/FormSG/pull/8805)
1018
- fix: add missing response id and time submitted in local generated pdf [`#8798`](https://github.com/opengovsg/FormSG/pull/8798)
1119
- build: merge release v6.255.0 to develop [`#8797`](https://github.com/opengovsg/FormSG/pull/8797)
1220
- fix(deps): bump tar-fs from 3.0.10 to 3.1.1 [`#8757`](https://github.com/opengovsg/FormSG/pull/8757)
1321
- fix(deps): bump moment-timezone from 0.5.41 to 0.6.0 [`#8708`](https://github.com/opengovsg/FormSG/pull/8708)
1422
- fix(deps): bump libphonenumber-js from 1.12.18 to 1.12.23 in /shared [`#8763`](https://github.com/opengovsg/FormSG/pull/8763)
1523
- build: release v6.255.0 [`#8796`](https://github.com/opengovsg/FormSG/pull/8796)
24+
- chore: bump version to v6.256.0 [`2ea61e8`](https://github.com/opengovsg/FormSG/commit/2ea61e84e36d5fead7ef8b443ef4a08d58ca9b03)
1625

1726
#### [v6.255.0](https://github.com/opengovsg/FormSG/compare/v6.254.0...v6.255.0)
1827

@@ -165,6 +174,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
165174
- build(deps): bump next from 15.3.4 to 15.5.2 in /react-email-preview [`#8660`](https://github.com/opengovsg/FormSG/pull/8660)
166175
- fix(deps): bump next from 15.3.4 to 15.5.2 [`#8661`](https://github.com/opengovsg/FormSG/pull/8661)
167176
- build(deps-dev): bump vite from 5.4.19 to 5.4.20 in /frontend [`#8686`](https://github.com/opengovsg/FormSG/pull/8686)
177+
- fix: home number fields are added to the draft despite not being modified [`#8704`](https://github.com/opengovsg/FormSG/pull/8704)
168178
- Revert "feat: save draft v1.0 (#8091)" [`ef00908`](https://github.com/opengovsg/FormSG/commit/ef00908c4fa711b8022f06a59595d13ec24d2963)
169179
- Revert "fix: home number fields are added to the draft despite not being modified (#8704)" [`8ceffce`](https://github.com/opengovsg/FormSG/commit/8ceffce1e0485fa4623cb941dd1042f73bedd5f6)
170180
- chore: bump version to v6.242.0 [`49cfc58`](https://github.com/opengovsg/FormSG/commit/49cfc582734a9110861ec37aa14932753639e334)
@@ -173,11 +183,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
173183

174184
> 16 September 2025
175185

176-
- fix: home number fields are added to the draft despite not being modified [`#8704`](https://github.com/opengovsg/FormSG/pull/8704)
177186
- feat: save draft v1.0 [`#8091`](https://github.com/opengovsg/FormSG/pull/8091)
178187
- build: merge release v6.240.0 to develop [`#8695`](https://github.com/opengovsg/FormSG/pull/8695)
179188
- build: release v6.240.0 [`#8693`](https://github.com/opengovsg/FormSG/pull/8693)
180-
- chore: bump version to v6.241.0 [`13345f3`](https://github.com/opengovsg/FormSG/commit/13345f3eabe3c954d90b8ec10ca4e15c6b709b68)
189+
- chore: bump version to v6.241.0 [`8572128`](https://github.com/opengovsg/FormSG/commit/8572128021278843f40d95dd30722a2f81370e5d)
181190

182191
#### [v6.240.0](https://github.com/opengovsg/FormSG/compare/v6.239.0...v6.240.0)
183192

@@ -1003,6 +1012,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
10031012
- build: merge release v6.178.2 to develop [`#8111`](https://github.com/opengovsg/FormSG/pull/8111)
10041013
- build: release v6.178.2 [`#8110`](https://github.com/opengovsg/FormSG/pull/8110)
10051014
- fix: also match amount paid [`#8109`](https://github.com/opengovsg/FormSG/pull/8109)
1015+
- fix: hawkeye v1.0 pending response at missing bug [`#8106`](https://github.com/opengovsg/FormSG/pull/8106)
1016+
- chore: remove coverage restriction, inspect through datadog instead [`#8100`](https://github.com/opengovsg/FormSG/pull/8100)
10061017
- chore: bump version to v6.179.0 [`1247426`](https://github.com/opengovsg/FormSG/commit/1247426080ba2254a33c8efb3deb51c6cd9f7e9e)
10071018
- chore: bump version to v6.178.2 [`618bdff`](https://github.com/opengovsg/FormSG/commit/618bdffa52a73fca82c53283ee7868390af42c91)
10081019
- chore: bump version to v6.180.0 [`13b3fc4`](https://github.com/opengovsg/FormSG/commit/13b3fc4c696810eb1c58a54edf4d583894022b52)
@@ -1011,15 +1022,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
10111022

10121023
> 13 February 2025
10131024

1014-
- fix: hawkeye v1.0 pending response at missing bug [`#8106`](https://github.com/opengovsg/FormSG/pull/8106)
1015-
- chore: remove coverage restriction, inspect through datadog instead [`#8100`](https://github.com/opengovsg/FormSG/pull/8100)
10161025
- feat: address field [`#7966`](https://github.com/opengovsg/FormSG/pull/7966)
10171026
- feat(mrf-admin-view): hawkeye v1.0 [`#7965`](https://github.com/opengovsg/FormSG/pull/7965)
10181027
- fix(deps): bump zod from 3.24.1 to 3.24.2 in /shared [`#8101`](https://github.com/opengovsg/FormSG/pull/8101)
10191028
- fix: failing test for new joi validation [`#8098`](https://github.com/opengovsg/FormSG/pull/8098)
10201029
- build: release v6.178.1 to develop [`#8096`](https://github.com/opengovsg/FormSG/pull/8096)
10211030
- build: merge release v6.178.0 to develop [`#8093`](https://github.com/opengovsg/FormSG/pull/8093)
1022-
- chore: bump version to v6.179.0 [`9ace3f2`](https://github.com/opengovsg/FormSG/commit/9ace3f23a41f089356ba43013a71d5e996748777)
1031+
- chore: bump version to v6.179.0 [`affeb5f`](https://github.com/opengovsg/FormSG/commit/affeb5f3ed0c9add243c763ebf02905f35e91bca)
10231032

10241033
#### [v6.178.2](https://github.com/opengovsg/FormSG/compare/v6.178.1...v6.178.2)
10251034

@@ -1090,40 +1099,44 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
10901099
- * fix(deps): bump libphonenumber-js from 1.11.16 to 1.11.17 in /shared (#8021) [`#8039`](https://github.com/opengovsg/FormSG/pull/8039)
10911100
- fix(deps): bump zod from 3.23.8 to 3.24.1 in /shared [`#7996`](https://github.com/opengovsg/FormSG/pull/7996)
10921101
- fix(deps): bump type-fest from 4.30.2 to 4.32.0 in /shared [`#8037`](https://github.com/opengovsg/FormSG/pull/8037)
1102+
- fix: set limit to 250kb for whitelist [`#8043`](https://github.com/opengovsg/FormSG/pull/8043)
1103+
- build: merge release v6.173.1 to develop [`#8044`](https://github.com/opengovsg/FormSG/pull/8044)
1104+
- build: release v6.173.1 [`#8042`](https://github.com/opengovsg/FormSG/pull/8042)
1105+
- fix: remove multer [`#8041`](https://github.com/opengovsg/FormSG/pull/8041)
1106+
- chore: bump version to v6.174.0 [`d3ee082`](https://github.com/opengovsg/FormSG/commit/d3ee082079a5a658aefb3821eb608b8497985bc5)
1107+
- chore: bump version to v6.173.1 [`70fd33a`](https://github.com/opengovsg/FormSG/commit/70fd33aa01b398f98f2b2dfee6880cd043889cc1)
10931108
- chore: bump version to v6.175.0 [`d31bb97`](https://github.com/opengovsg/FormSG/commit/d31bb9717625d365d6798a51d8235b5acdab706c)
10941109

10951110
#### [v6.174.0](https://github.com/opengovsg/FormSG/compare/v6.173.1...v6.174.0)
10961111

10971112
> 13 January 2025
10981113

1099-
- fix: set limit to 250kb for whitelist [`#8043`](https://github.com/opengovsg/FormSG/pull/8043)
1100-
- build: merge release v6.173.1 to develop [`#8044`](https://github.com/opengovsg/FormSG/pull/8044)
1101-
- build: release v6.173.1 [`#8042`](https://github.com/opengovsg/FormSG/pull/8042)
11021114
- fix: only show fixed translations for supported forms [`#8038`](https://github.com/opengovsg/FormSG/pull/8038)
11031115
- feat(iframe): add frame messaging for paysg [`#7979`](https://github.com/opengovsg/FormSG/pull/7979)
11041116
- chore: mongoose, nanoid packages update [`#8000`](https://github.com/opengovsg/FormSG/pull/8000)
11051117
- build: merge release v6.173.0 to develop [`#8034`](https://github.com/opengovsg/FormSG/pull/8034)
11061118
- fix(deps): bump libphonenumber-js from 1.11.16 to 1.11.17 in /shared [`#8021`](https://github.com/opengovsg/FormSG/pull/8021)
1107-
- chore: bump version to v6.174.0 [`d3ee082`](https://github.com/opengovsg/FormSG/commit/d3ee082079a5a658aefb3821eb608b8497985bc5)
1119+
- chore: bump version to v6.174.0 [`22b1122`](https://github.com/opengovsg/FormSG/commit/22b1122e8e15dbb8ca4c69c1d6c026a865d3b67c)
11081120

11091121
#### [v6.173.1](https://github.com/opengovsg/FormSG/compare/v6.173.0...v6.173.1)
11101122

11111123
> 13 January 2025
11121124

11131125
- fix: remove multer [`#8041`](https://github.com/opengovsg/FormSG/pull/8041)
11141126
- * fix(deps): bump fp-ts from 2.16.8 to 2.16.9 (#8017) [`#8027`](https://github.com/opengovsg/FormSG/pull/8027)
1127+
- fix: update mongodb binary version to 6 [`#8032`](https://github.com/opengovsg/FormSG/pull/8032)
11151128
- chore: bump version to v6.173.1 [`70fd33a`](https://github.com/opengovsg/FormSG/commit/70fd33aa01b398f98f2b2dfee6880cd043889cc1)
1129+
- chore: bump version to v6.173.0 [`54e544d`](https://github.com/opengovsg/FormSG/commit/54e544d9835af07fbcd2b0218ed522c26b18fa5e)
11161130

11171131
#### [v6.173.0](https://github.com/opengovsg/FormSG/compare/v6.172.0...v6.173.0)
11181132

11191133
> 7 January 2025
11201134

1121-
- fix: update mongodb binary version to 6 [`#8032`](https://github.com/opengovsg/FormSG/pull/8032)
11221135
- feat: multi lang feature [`#8022`](https://github.com/opengovsg/FormSG/pull/8022)
11231136
- fix(deps): bump fp-ts from 2.16.8 to 2.16.9 [`#8017`](https://github.com/opengovsg/FormSG/pull/8017)
11241137
- build: merge release v6.172.0 to develop [`#8016`](https://github.com/opengovsg/FormSG/pull/8016)
11251138
- build: release v6.172.0 [`#8015`](https://github.com/opengovsg/FormSG/pull/8015)
1126-
- chore: bump version to v6.173.0 [`54e544d`](https://github.com/opengovsg/FormSG/commit/54e544d9835af07fbcd2b0218ed522c26b18fa5e)
1139+
- chore: bump version to v6.173.0 [`1cb7772`](https://github.com/opengovsg/FormSG/commit/1cb7772374249830091d1fb3278a035957d23bcb)
11271140

11281141
#### [v6.172.0](https://github.com/opengovsg/FormSG/compare/v6.171.0...v6.172.0)
11291142

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "form-frontend",
3-
"version": "6.256.0",
3+
"version": "6.257.0",
44
"homepage": ".",
55
"type": "module",
66
"private": true,

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "FormSG",
33
"description": "Form Manager for Government",
4-
"version": "6.256.0",
4+
"version": "6.257.0",
55
"homepage": "https://form.gov.sg",
66
"authors": [
77
"FormSG <[email protected]>"

shared/types/form/form.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ export type DuplicateFormOverwriteDto = {
395395
| {
396396
responseMode: FormResponseMode.Multirespondent
397397
publicKey: string
398+
workflow?: FormWorkflowDto
398399
}
399400
)
400401

src/app/models/__tests__/form.server.model.spec.ts

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,6 +2830,118 @@ describe('Form Model', () => {
28302830
)
28312831

28322832
expect(duplicatedForm).not.toHaveProperty('whitelistedSubmitterIds')
2833+
expect(duplicatedForm.workflow).toBeUndefined()
2834+
})
2835+
2836+
describe('for multirespondent form', () => {
2837+
const MOCK_EMAIL_FIELD = {
2838+
_id: new ObjectId().toString(),
2839+
fieldType: BasicField.Email,
2840+
}
2841+
const MOCK_DROPDOWN_FIELD = {
2842+
_id: new ObjectId().toString(),
2843+
fieldType: BasicField.Dropdown,
2844+
optionsToRecipientsMap: {
2845+
'Option 1': ['[email protected]'],
2846+
},
2847+
}
2848+
const MOCK_YES_NO_FIELD = {
2849+
_id: new ObjectId().toString(),
2850+
fieldType: BasicField.YesNo,
2851+
}
2852+
const MOCK_FORM_FIELDS = [
2853+
MOCK_EMAIL_FIELD,
2854+
MOCK_DROPDOWN_FIELD,
2855+
MOCK_YES_NO_FIELD,
2856+
]
2857+
const MOCK_WORKFLOW = [
2858+
{
2859+
_id: new ObjectId().toString(),
2860+
workflow_type: WorkflowType.Static,
2861+
emails: ['[email protected]'],
2862+
edit: [MOCK_EMAIL_FIELD._id],
2863+
},
2864+
{
2865+
_id: new ObjectId().toString(),
2866+
workflow_type: WorkflowType.Dynamic,
2867+
field: new ObjectId().toString(),
2868+
edit: [MOCK_DROPDOWN_FIELD._id],
2869+
},
2870+
{
2871+
_id: new ObjectId().toString(),
2872+
workflow_type: WorkflowType.Conditional,
2873+
conditional_field: new ObjectId().toString(),
2874+
edit: [MOCK_YES_NO_FIELD._id],
2875+
},
2876+
]
2877+
2878+
it('should duplicate all required fields, including workflow', () => {
2879+
const MOCK_ALL_OVERRIDE_PARAMS = {
2880+
admin: 'duplicated admin',
2881+
title: 'duplicated mrf form title',
2882+
responseMode: FormResponseMode.Multirespondent,
2883+
publicKey: 'duplicated public key',
2884+
}
2885+
const MOCK_ALL_FORM_PARAMS = {
2886+
title: 'Test Form',
2887+
admin: MOCK_ADMIN_OBJ_ID,
2888+
isSubmitterIdCollectionEnabled: true,
2889+
isSingleSubmission: true,
2890+
isSaveDraftEnabled: true,
2891+
inactiveMessage: 'inactive_test',
2892+
responseMode: FormResponseMode.Multirespondent,
2893+
submissionLimit: 1000,
2894+
publicKey: 'initial public key',
2895+
workflow: MOCK_WORKFLOW,
2896+
form_fields: MOCK_FORM_FIELDS,
2897+
}
2898+
2899+
const sourceForm = new MultirespondentForm(MOCK_ALL_FORM_PARAMS)
2900+
const duplicatedForm = sourceForm.getDuplicateParams(
2901+
MOCK_ALL_OVERRIDE_PARAMS,
2902+
)
2903+
2904+
// Assert overriden fields
2905+
expect(duplicatedForm.title).toEqual(MOCK_ALL_OVERRIDE_PARAMS.title)
2906+
expect(duplicatedForm.admin).toEqual(MOCK_ALL_OVERRIDE_PARAMS.admin)
2907+
expect(duplicatedForm.responseMode).toEqual(
2908+
MOCK_ALL_OVERRIDE_PARAMS.responseMode,
2909+
)
2910+
expect(duplicatedForm.publicKey).toEqual(
2911+
MOCK_ALL_OVERRIDE_PARAMS.publicKey,
2912+
)
2913+
2914+
// Assert unoverriden fields
2915+
// Assert workflow is duplicated
2916+
const duplicatedWorkflow = JSON.parse(
2917+
JSON.stringify(duplicatedForm.workflow),
2918+
)
2919+
expect(duplicatedWorkflow).toEqual(MOCK_ALL_FORM_PARAMS.workflow)
2920+
2921+
const duplicatedFormFieldIds = JSON.parse(
2922+
JSON.stringify(duplicatedForm.form_fields),
2923+
).map((field: FormFieldDto) => field._id)
2924+
const expectedFormFieldIds = MOCK_ALL_FORM_PARAMS.form_fields.map(
2925+
(field) => field._id,
2926+
)
2927+
expect(duplicatedFormFieldIds).toEqual(expectedFormFieldIds)
2928+
2929+
expect(duplicatedForm.submissionLimit).toEqual(
2930+
MOCK_ALL_FORM_PARAMS.submissionLimit,
2931+
)
2932+
expect(duplicatedForm.isSubmitterIdCollectionEnabled).toEqual(
2933+
MOCK_ALL_FORM_PARAMS.isSubmitterIdCollectionEnabled,
2934+
)
2935+
expect(duplicatedForm.isSingleSubmission).toEqual(
2936+
MOCK_ALL_FORM_PARAMS.isSingleSubmission,
2937+
)
2938+
expect(duplicatedForm.isSaveDraftEnabled).toEqual(
2939+
MOCK_ALL_FORM_PARAMS.isSaveDraftEnabled,
2940+
)
2941+
expect(duplicatedForm.inactiveMessage).toEqual(
2942+
MOCK_ALL_FORM_PARAMS.inactiveMessage,
2943+
)
2944+
})
28332945
})
28342946
})
28352947

src/app/models/form.server.model.ts

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@ import { isPositiveInteger } from './utils'
122122

123123
export const FORM_SCHEMA_ID = 'Form'
124124

125+
const FORM_SCHEMA_COMMON_DUPLICATE_PARAMS = [
126+
'form_fields',
127+
'form_logics',
128+
'startPage',
129+
'endPage',
130+
'authType',
131+
'isSaveDraftEnabled',
132+
'isSubmitterIdCollectionEnabled',
133+
'isSingleSubmission',
134+
'inactiveMessage',
135+
'responseMode',
136+
'submissionLimit',
137+
] as const
138+
125139
const formSchemaOptions: SchemaOptions<IFormSchema> = {
126140
id: false,
127141
toJSON: {
@@ -444,6 +458,16 @@ const MultirespondentFormSchema = new Schema<IMultirespondentFormSchema>({
444458
},
445459
})
446460

461+
MultirespondentFormSchema.methods.getDuplicateParams = function (
462+
overrideProps: OverrideProps,
463+
) {
464+
const newForm = pick(this, [
465+
...FORM_SCHEMA_COMMON_DUPLICATE_PARAMS,
466+
'workflow',
467+
]) as PickDuplicateForm
468+
return { ...newForm, ...overrideProps }
469+
}
470+
447471
const MultirespondentFormWorkflowPath = MultirespondentFormSchema.path(
448472
'workflow',
449473
) as Schema.Types.DocumentArray
@@ -923,19 +947,10 @@ const compileFormModel = (db: Mongoose): IFormModel => {
923947
FormSchema.methods.getDuplicateParams = function (
924948
overrideProps: OverrideProps,
925949
) {
926-
const newForm = pick(this, [
927-
'form_fields',
928-
'form_logics',
929-
'startPage',
930-
'endPage',
931-
'authType',
932-
'isSaveDraftEnabled',
933-
'isSubmitterIdCollectionEnabled',
934-
'isSingleSubmission',
935-
'inactiveMessage',
936-
'responseMode',
937-
'submissionLimit',
938-
]) as PickDuplicateForm
950+
const newForm = pick(
951+
this,
952+
FORM_SCHEMA_COMMON_DUPLICATE_PARAMS,
953+
) as PickDuplicateForm
939954
return { ...newForm, ...overrideProps }
940955
}
941956

0 commit comments

Comments
 (0)