Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: merge Release 5.4.1 into master #1563

Merged
merged 44 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9d1696b
Merge pull request #1247 from opengovsg/release-5.0.3
liangyuanruo Feb 25, 2021
3957107
Merge pull request #1249 from opengovsg/release-v5.0.4
mantariksh Feb 25, 2021
ffa5606
Merge pull request #1337 from opengovsg/release-5.1.0
tshuli Mar 10, 2021
6074186
Merge pull request #1381 from opengovsg/release-v5.2.0
mantariksh Mar 16, 2021
32eab3a
refactor: migrate table validator to typescript (#1316)
tshuli Mar 23, 2021
32f34e3
feat: remove isTemplate validation on duplicate template api (#1432)
karrui Mar 23, 2021
7e92d74
Merge pull request #1430 from opengovsg/release-v5.3.0
karrui Mar 23, 2021
856d91f
Merge pull request #1436 from opengovsg/release-v5.3.0
karrui Mar 23, 2021
8cbca13
refactor: display verification error message if present (#1443)
mantariksh Mar 24, 2021
6e00a92
chore(deps-dev): bump sinon from 9.2.4 to 10.0.0 (#1429)
dependabot[bot] Mar 24, 2021
8ec05eb
ref: collapse middlewares of /adminform/submissions/download (#1442)
karrui Mar 24, 2021
35bbe33
fix(deps): bump @sentry/browser from 6.2.2 to 6.2.3 (#1422)
dependabot[bot] Mar 24, 2021
d0967a8
chore(deps-dev): bump @typescript-eslint/parser from 4.18.0 to 4.19.0…
dependabot[bot] Mar 24, 2021
4d42834
chore(deps-dev): bump husky from 5.1.3 to 5.2.0 (#1447)
dependabot[bot] Mar 24, 2021
e652e2e
fix(deps): bump aws-sdk from 2.866.0 to 2.870.0 (#1449)
dependabot[bot] Mar 24, 2021
144f237
build: fix mergify config (#1456)
mantariksh Mar 24, 2021
995e593
chore(deps-dev): bump @babel/preset-env from 7.13.10 to 7.13.12 (#1457)
dependabot[bot] Mar 24, 2021
e62eccc
chore(deps-dev): bump testcafe from 1.12.0 to 1.13.0 (#1460)
dependabot[bot] Mar 24, 2021
651380b
fix(deps): bump connect-mongo from 4.4.0 to 4.4.1 (#1459)
dependabot[bot] Mar 24, 2021
0d3bef7
chore(deps-dev): bump mockdate from 3.0.3 to 3.0.4 (#1458)
dependabot[bot] Mar 24, 2021
f69e478
chore(deps-dev): bump @typescript-eslint/eslint-plugin (#1448)
dependabot[bot] Mar 24, 2021
4351f19
fix: shortened sms otp copy for accessibility (#1461)
r00dgirl Mar 25, 2021
ca58981
chore: copy changes (#1408)
r00dgirl Mar 25, 2021
6a4ccf7
feat: add samesite GA cookie property to enable GA in iframe (#1463)
barnettx Mar 25, 2021
e9e3169
fix(deps): bump aws-sdk from 2.870.0 to 2.871.0 (#1464)
dependabot[bot] Mar 25, 2021
4db712d
fix(deps): bump twilio from 3.58.0 to 3.59.0 (#1465)
dependabot[bot] Mar 26, 2021
4aa7902
refactor: move Verification files together (part 1) (#1450)
mantariksh Mar 26, 2021
1a440d9
refactor: Migrate 3 more filters to handleEncryptedSubmission (#1420)
frankchn Mar 28, 2021
49037a4
chore(deps-dev): bump @babel/core from 7.13.10 to 7.13.13 (#1467)
dependabot[bot] Mar 28, 2021
1d77928
fix(deps): bump aws-sdk from 2.871.0 to 2.874.0 (#1468)
dependabot[bot] Mar 28, 2021
a2f0c93
chore(deps-dev): bump @types/jest from 26.0.21 to 26.0.22 (#1470)
dependabot[bot] Mar 28, 2021
950a95a
chore(deps-dev): bump @types/node from 14.14.35 to 14.14.37 (#1471)
dependabot[bot] Mar 28, 2021
9080d51
chore(deps-dev): bump mockdate from 3.0.4 to 3.0.5 (#1472)
dependabot[bot] Mar 28, 2021
0155926
chore(deps-dev): bump eslint from 7.22.0 to 7.23.0 (#1473)
dependabot[bot] Mar 28, 2021
78e1767
feat: remove adminform passThroughFeedback (#1298)
jia1 Mar 29, 2021
f5f8144
chore: take csv and attachments download out of beta (#1466)
r00dgirl Mar 29, 2021
016e6fe
refactor: remove deprecated analytics API endpoints (#1427)
liangyuanruo Mar 29, 2021
cc24724
refactor: migrate field validator tests to typescript (#1444)
tshuli Mar 29, 2021
a9789c3
feat: revert custom code for CorpPass cloud migration (#1476)
mantariksh Mar 29, 2021
b3a4384
refactor: remove unnecessary field validator JS tests in favour of TS…
liangyuanruo Mar 29, 2021
b9d1732
chore: bump version to 5.4.0
mantariksh Mar 30, 2021
3ab46d7
Merge pull request #1493 from opengovsg/release-v5.4.0
mantariksh Mar 30, 2021
91551a9
fix: server to respond with status code if storage mode form is archived
Apr 1, 2021
7fb57ad
build: release 5.4.1 - server to respond with status code if storage …
Apr 1, 2021
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
4 changes: 3 additions & 1 deletion .github/.mergify.yml → .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
pull_request_rules:
- name: Merge dependency upgrades when tests pass
- name: Approve and merge non-major dependency upgrades
conditions:
- 'author=dependabot[bot]'
- '#check-failure=0'
- 'title~=bump [^\s]+ from ([\d]+)\..+ to \1\.'
actions:
review:
type: APPROVE
merge:
method: squash
112 changes: 97 additions & 15 deletions CHANGELOG.md

Large diffs are not rendered by default.

770 changes: 461 additions & 309 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "5.3.0",
"version": "5.4.1",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <[email protected]>"
Expand Down Expand Up @@ -64,7 +64,7 @@
"@opengovsg/myinfo-gov-client": "=4.0.0-beta.0",
"@opengovsg/ng-file-upload": "^12.2.15",
"@opengovsg/spcp-auth-client": "^1.4.4",
"@sentry/browser": "^6.2.2",
"@sentry/browser": "^6.2.3",
"@sentry/integrations": "^6.2.3",
"@stablelib/base64": "^1.0.0",
"JSONStream": "^1.3.5",
Expand All @@ -84,7 +84,7 @@
"angular-ui-bootstrap": "~2.5.6",
"angular-ui-router": "~1.0.29",
"aws-info": "^1.2.0",
"aws-sdk": "^2.866.0",
"aws-sdk": "^2.874.0",
"axios": "^0.21.1",
"bcrypt": "^5.0.1",
"bluebird": "^3.5.2",
Expand All @@ -95,7 +95,7 @@
"busboy": "^0.3.1",
"celebrate": "^14.0.0",
"compression": "~1.7.2",
"connect-mongo": "^4.4.0",
"connect-mongo": "^4.4.1",
"convict": "^6.0.1",
"convict-format-with-validator": "^6.0.1",
"cookie-parser": "~1.4.0",
Expand Down Expand Up @@ -147,7 +147,7 @@
"toastr": "^2.1.4",
"triple-beam": "^1.3.0",
"tweetnacl": "^1.0.1",
"twilio": "^3.58.0",
"twilio": "^3.59.0",
"ui-select": "^0.19.8",
"uid-generator": "^2.0.0",
"uuid": "^8.3.2",
Expand All @@ -158,9 +158,9 @@
"winston-cloudwatch": "^2.5.0"
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/core": "^7.13.13",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-env": "^7.13.12",
"@opengovsg/mockpass": "^2.6.8",
"@types/bcrypt": "^3.0.0",
"@types/bluebird": "^3.5.33",
Expand All @@ -178,11 +178,11 @@
"@types/has-ansi": "^3.0.0",
"@types/helmet": "4.0.0",
"@types/ip": "^1.1.0",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/json-stringify-safe": "^5.0.0",
"@types/mongodb": "^3.6.10",
"@types/mongodb-uri": "^0.9.0",
"@types/node": "^14.14.35",
"@types/node": "^14.14.37",
"@types/nodemailer": "^6.4.1",
"@types/nodemailer-direct-transport": "^1.0.31",
"@types/opossum": "^4.1.1",
Expand All @@ -194,8 +194,8 @@
"@types/uid-generator": "^2.0.2",
"@types/uuid": "^8.3.0",
"@types/validator": "^13.1.3",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"auto-changelog": "^2.2.1",
"axios-mock-adapter": "^1.19.0",
"babel-loader": "^8.2.2",
Expand All @@ -205,8 +205,9 @@
"coveralls": "^3.1.0",
"css-loader": "^2.1.1",
"csv-parse": "^4.15.3",
"date-fns": "^2.19.0",
"env-cmd": "^10.1.0",
"eslint": "^7.22.0",
"eslint": "^7.23.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-angular": "^4.0.1",
"eslint-plugin-import": "^2.22.1",
Expand All @@ -218,7 +219,7 @@
"google-fonts-plugin": "4.1.0",
"html-loader": "~0.5.5",
"htmlhint": "^0.14.2",
"husky": "^5.1.3",
"husky": "^5.2.0",
"jasmine": "^3.7.0",
"jasmine-core": "^3.7.1",
"jasmine-sinon": "^0.4.0",
Expand All @@ -229,7 +230,7 @@
"lint-staged": "^10.5.4",
"maildev": "^1.1.0",
"mini-css-extract-plugin": "^0.5.0",
"mockdate": "^3.0.3",
"mockdate": "^3.0.5",
"mockingoose": "^2.13.2",
"mongodb-memory-server-core": "^6.9.6",
"ngrok": "^3.4.1",
Expand All @@ -238,15 +239,15 @@
"proxyquire": "^2.1.3",
"regenerator": "^0.14.4",
"rimraf": "^3.0.2",
"sinon": "^9.2.4",
"sinon": "^10.0.0",
"stylelint": "^13.12.0",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^21.0.0",
"stylelint-prettier": "^1.2.0",
"supertest": "^6.1.3",
"supertest-session": "^4.1.0",
"terser-webpack-plugin": "^1.2.3",
"testcafe": "^1.12.0",
"testcafe": "^1.13.0",
"ts-jest": "^26.5.4",
"ts-loader": "^7.0.5",
"ts-mock-imports": "^1.3.3",
Expand Down
23 changes: 0 additions & 23 deletions src/app/controllers/admin-forms.server.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,6 @@ function makeModule(connection) {
}
return next()
},
/**
* Submit feedback when previewing forms
* Preview feedback is not stored
* @param {Object} req - Express request object
* @param {Object} res - Express response object
*/
passThroughFeedback: function (req, res) {
if (
!req.params ||
!('formId' in req.params) ||
!req.body ||
!('rating' in req.body) ||
!('comment' in req.body)
) {
return res
.status(StatusCodes.BAD_REQUEST)
.json({ message: 'Form feedback data not passed in' })
} else {
return res
.status(StatusCodes.OK)
.json({ message: 'Successfully received feedback' })
}
},
/**
* Pass through save new Submission object to db
* Simply create and pass forward a submissions object w/o saving to db
Expand Down
3 changes: 2 additions & 1 deletion src/app/controllers/frontend.server.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports.datalayer = function (req, res) {
gtag('js', new Date());
gtag('config', '<%= GATrackingID%>', {
'send_page_view': false,
'app_name': '<%= appName%>'
'app_name': '<%= appName%>',
'cookie_flags': 'samesite=none;secure',
});
`
try {
Expand Down
118 changes: 0 additions & 118 deletions src/app/modules/analytics/__tests__/analytics.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,124 +11,6 @@ describe('analytics.controller', () => {
const MOCK_REQ = expressHandler.mockRequest()
afterEach(() => jest.clearAllMocks())

describe('handleGetUserCount', () => {
it('should return 200 with number of users on success', async () => {
// Arrange
const mockRes = expressHandler.mockResponse()
const mockUserCount = 21
const getUserSpy = jest
.spyOn(AnalyticsService, 'getUserCount')
.mockReturnValueOnce(TE.of(mockUserCount))

// Act
await AnalyticsController.handleGetUserCount(MOCK_REQ, mockRes, jest.fn())

// Assert
expect(getUserSpy).toHaveBeenCalledTimes(1)
expect(mockRes.status).not.toHaveBeenCalled()
expect(mockRes.json).toHaveBeenCalledWith(mockUserCount)
})

it('should return 500 when error occurs whilst retrieving user count', async () => {
const mockRes = expressHandler.mockResponse()
const getUserSpy = jest
.spyOn(AnalyticsService, 'getUserCount')
.mockReturnValueOnce(TE.fromEither(E.left(new DatabaseError())))

// Act
await AnalyticsController.handleGetUserCount(MOCK_REQ, mockRes, jest.fn())

// Assert
expect(getUserSpy).toHaveBeenCalledTimes(1)
expect(mockRes.status).toHaveBeenCalledWith(500)
expect(mockRes.json).toHaveBeenCalledWith(
'Unable to retrieve number of users from the database',
)
})
})

describe('handleGetSubmissionCount', () => {
it('should return 200 with number of submissions on success', async () => {
// Arrange
const mockSubmissionCount = 1234
const mockRes = expressHandler.mockResponse()
const getSubsSpy = jest
.spyOn(AnalyticsService, 'getSubmissionCount')
.mockReturnValueOnce(TE.of(mockSubmissionCount))

// Act
await AnalyticsController.handleGetSubmissionCount(
MOCK_REQ,
mockRes,
jest.fn(),
)

// Assert
expect(getSubsSpy).toHaveBeenCalledTimes(1)
expect(mockRes.status).not.toHaveBeenCalled()
expect(mockRes.json).toHaveBeenCalledWith(mockSubmissionCount)
})

it('should return 500 when error occurs whilst retrieving submission count', async () => {
// Arrange
const mockRes = expressHandler.mockResponse()
const getSubsSpy = jest
.spyOn(AnalyticsService, 'getSubmissionCount')
.mockReturnValueOnce(TE.fromEither(E.left(new DatabaseError())))

// Act
await AnalyticsController.handleGetSubmissionCount(
MOCK_REQ,
mockRes,
jest.fn(),
)

// Assert
expect(getSubsSpy).toHaveBeenCalledTimes(1)
expect(mockRes.status).toHaveBeenCalledWith(500)
expect(mockRes.json).toHaveBeenCalledWith(
'Unable to retrieve number of submissions from the database',
)
})
})

describe('handleGetFormCount', () => {
it('should return 200 with number of forms on success', async () => {
// Arrange
const mockFormCount = 99543
const mockRes = expressHandler.mockResponse()
const getFormSpy = jest
.spyOn(AnalyticsService, 'getFormCount')
.mockReturnValueOnce(TE.of(mockFormCount))

// Act
await AnalyticsController.handleGetFormCount(MOCK_REQ, mockRes, jest.fn())

// Assert
expect(getFormSpy).toHaveBeenCalledTimes(1)
expect(mockRes.status).not.toHaveBeenCalled()
expect(mockRes.json).toHaveBeenCalledWith(mockFormCount)
})

it('should return 500 when error occurs whilst retrieving form count', async () => {
// Arrange
const mockRes = expressHandler.mockResponse()
const getFormSpy = jest
.spyOn(AnalyticsService, 'getFormCount')
.mockReturnValueOnce(TE.fromEither(E.left(new DatabaseError())))

// Act
await AnalyticsController.handleGetFormCount(MOCK_REQ, mockRes, jest.fn())

// Assert
expect(getFormSpy).toHaveBeenCalledTimes(1)
expect(mockRes.status).toHaveBeenCalledWith(500)
expect(mockRes.json).toHaveBeenCalledWith(
'Unable to retrieve number of forms from the database',
)
})
})

describe('handleGetStatistics', () => {
it('should return HTTP 200 when calls to AnalyticsService do not return any errors', async () => {
// Arrange
Expand Down
Loading