Skip to content

Commit

Permalink
Merge pull request #7249 from opengovsg/release-al2
Browse files Browse the repository at this point in the history
build: merge release v6.115.1 back to develop
  • Loading branch information
KenLSM authored Apr 5, 2024
2 parents c8830f4 + 5a631f5 commit f13342d
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 8 deletions.
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,35 @@ All notable changes to this project will be documented in this file. Dates are d

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

#### [v6.115.1](https://github.com/opengovsg/FormSG/compare/v6.115.0...v6.115.1)

- * chore(deps-dev): bump @types/express from 4.17.17 to 4.17.21 (#7233) [`#7241`](https://github.com/opengovsg/FormSG/pull/7241)
- fix: add check to block webhooks updates on mrf [`71ab0c5`](https://github.com/opengovsg/FormSG/commit/71ab0c592c15de5fddbffc9970a424af7a31d4ab)

#### [v6.115.0](https://github.com/opengovsg/FormSG/compare/v6.114.1...v6.115.0)

> 3 April 2024

- fix: correct date validation for disabled fields [`#7240`](https://github.com/opengovsg/FormSG/pull/7240)
- build: merge release v6.114.1 back to develop [`#7228`](https://github.com/opengovsg/FormSG/pull/7228)
- chore(mrf): add announcement content [`#7229`](https://github.com/opengovsg/FormSG/pull/7229)
- chore(mrf): remove flags [`#7230`](https://github.com/opengovsg/FormSG/pull/7230)
- fix(mrf): workflow email UI cleanup [`#7215`](https://github.com/opengovsg/FormSG/pull/7215)
- fix: add secret key input mask [`#7227`](https://github.com/opengovsg/FormSG/pull/7227)
- fix: correcting submission button bug for MRF [`#7232`](https://github.com/opengovsg/FormSG/pull/7232)
- fix(mrf): handling for incorrect submission secret key in url query params [`#7219`](https://github.com/opengovsg/FormSG/pull/7219)
- chore(deps-dev): bump @types/json-stringify-safe from 5.0.0 to 5.0.3 [`#7235`](https://github.com/opengovsg/FormSG/pull/7235)
- fix(deps): bump nan from 2.17.0 to 2.19.0 [`#7212`](https://github.com/opengovsg/FormSG/pull/7212)
- chore(deps-dev): bump @types/express from 4.17.17 to 4.17.21 [`#7233`](https://github.com/opengovsg/FormSG/pull/7233)
- chore: bump version to v6.115.0 [`8f02ef7`](https://github.com/opengovsg/FormSG/commit/8f02ef7e50f709ecb1b7ab55f1dfc867e41c6662)

#### [v6.114.1](https://github.com/opengovsg/FormSG/compare/v6.114.0...v6.114.1)

> 3 April 2024

- build: release v6.114.0 [`#7226`](https://github.com/opengovsg/FormSG/pull/7226)
- fix: correcting submission button bug for MRF [`7342138`](https://github.com/opengovsg/FormSG/commit/73421387daf8f3a33c0030a43c81bb11190ee198)
- ref: genericize EndPageBlock [`017cfb3`](https://github.com/opengovsg/FormSG/commit/017cfb36457cbe293360c963f3d66257e5172907)
- chore: bump version to 6.114.1 [`c1c7ac2`](https://github.com/opengovsg/FormSG/commit/c1c7ac29e6bd8e2c3ab80b2fde22f84b778f1b4f)
- fix: correcting submission button bug for MRF [`96628aa`](https://github.com/opengovsg/FormSG/commit/96628aa3b4dd5abae00b429486139431a8b3bf05)

#### [v6.114.0](https://github.com/opengovsg/FormSG/compare/v6.113.0...v6.114.0)

Expand Down
4 changes: 2 additions & 2 deletions frontend/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 frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.114.1",
"version": "6.115.1",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
4 changes: 2 additions & 2 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
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "6.114.1",
"version": "6.115.1",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <[email protected]>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
DatabaseError,
DatabasePayloadSizeError,
DatabaseValidationError,
MalformedParametersError,
} from 'src/app/modules/core/core.errors'
import { MissingUserError } from 'src/app/modules/user/user.errors'
import * as UserService from 'src/app/modules/user/user.service'
Expand Down Expand Up @@ -1419,6 +1420,47 @@ describe('admin-form.service', () => {
)
expect(MOCK_UPDATED_FORM.getSettings).toHaveBeenCalledTimes(0)
})

it('should not allow webhooks updates for MRF', async () => {
const MOCK_MULTIRESPONDENT_FORM = jest.mocked({
_id: new ObjectId(),
status: FormStatus.Public,
responseMode: FormResponseMode.Multirespondent,
} as unknown as IPopulatedForm)
const settingsToUpdate: SettingsUpdateDto = {
webhook: {
url: 'does not matter',
},
}

// Act
const actualResult = await AdminFormService.updateFormSettings(
MOCK_MULTIRESPONDENT_FORM,
settingsToUpdate,
)

// Assert
expect(actualResult._unsafeUnwrapErr()).toBeInstanceOf(
MalformedParametersError,
)
})

it('should allow webhooks updates for encrypt form', async () => {
const settingsToUpdate: SettingsUpdateDto = {
webhook: {
url: 'does not matter',
},
}

// Act
const actualResult = await AdminFormService.updateFormSettings(
MOCK_ENCRYPT_FORM,
settingsToUpdate,
)

// Assert
expect(actualResult.isOk()).toBeTrue()
})
})

describe('updateFormField', () => {
Expand Down
10 changes: 10 additions & 0 deletions src/app/modules/form/admin-form/admin-form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ export const updateFormCollaborators = (
* @param body the subset of form settings to update
* @returns ok(updated form settings) on success
* @returns err(MalformedParametersError) if auth type update is attempted for a multi-respondent form
* @returns err(MalformedParametersError) if webhook update is attempted for a multi-respondent form
* @returns err(database errors) if db error is thrown during form setting update
*/
export const updateFormSettings = (
Expand All @@ -1063,6 +1064,15 @@ export const updateFormSettings = (
return errAsync(new MalformedParametersError('Invalid authentication type'))
}

if (
originalForm.responseMode === FormResponseMode.Multirespondent &&
Boolean(body.webhook?.url)
) {
return errAsync(
new MalformedParametersError('Webhooks not supported on MRF'),
)
}

const dotifiedSettingsToUpdate = dotifyObject(body)
const ModelToUse = getFormModelByResponseMode(originalForm.responseMode)

Expand Down

0 comments on commit f13342d

Please sign in to comment.