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

refactor: collapse encrypt preview submission middleware #1554

Merged
merged 21 commits into from
Apr 8, 2021

Conversation

mantariksh
Copy link
Contributor

@mantariksh mantariksh commented Apr 5, 2021

Combines the middleware for the endpoint which handles storage mode preview submissions.

Closes #1435

Other improvements

While writing integration tests, I noticed a couple of issues with the Joi validation shared by the actual submission and preview submission endpoints:

  1. helper.error results in Joi returning an error message, because they require a custom string (e.g. 'any.custom') to be passed as the first argument, rather than our own error message.
  2. The encryptedFile key in individual attachments was not a required key, even though it should be.

These two issues have been fixed in encrypt-submission.middleware.ts.

Tests

  • Create a storage mode form and add an email field with email confirmation. Submit it in preview mode. You should not be able to see the response in the data tab, but you should receive the email confirmation.
  • Change the authType to SP and submit in preview mode.
  • Change the authType to CP and submit in preview mode.

@mantariksh mantariksh force-pushed the ref/encrypt-preview-middleware branch from a7ea38c to 6615182 Compare April 7, 2021 11:54
@mantariksh mantariksh force-pushed the ref/encrypt-preview-middleware branch from c2f7361 to d49ae3f Compare April 8, 2021 02:24
@mantariksh mantariksh marked this pull request as ready for review April 8, 2021 02:45
@mantariksh mantariksh requested review from karrui, tshuli, seaerchin and orbitalsqwib and removed request for karrui April 8, 2021 02:45
Copy link
Contributor

@karrui karrui left a comment

Choose a reason for hiding this comment

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

lgtm 🎉

@mantariksh mantariksh merged commit b619f7b into develop Apr 8, 2021
@karrui karrui mentioned this pull request Apr 13, 2021
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.

Migrate encrypt-submissions.server.controller.js to TS
3 participants