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

feat: extract public form submission flow (and preview) to specific Typescript services #1917

Merged
merged 17 commits into from
May 25, 2021

Conversation

karrui
Copy link
Contributor

@karrui karrui commented May 18, 2021

Ready for review

Problem

This PR extracts out the existing post function in submissions.client.factory.js into their own disparate functions.

The original post function used in submit-form.directive is now replaced with the exported typescript service functions that has no usages of any angularjs specific effects.

This PR also makes isPreview key in submission Joi validator optional, since they were never being used by the various controllers and were only in the body for the client to choose the correct route... The key cannot be removed yet due to old clients sending the key. The extracted functions in this PR no longer send isPreview to the server.

Closes #1873

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
    • isPreview is no longer being passed to the backend, meaning old servers will reject new client's calls
  • No - this PR is backwards compatible

Features:

  • Add various services and utility functions for the refactored flow
    • feat(submissionUtl): add createEmailSubmissionFormData util function
    • feat(PublicFormService): add submit email/encrypt mode form service fn
    • feat(AdminFormService): add preview submit email/encrypt mode form fns

Improvements:

  • ref: call new email/encrypt submission api instead of submission fty,
  • handle axios errors properly due to new error shape
  • feat: remove unused Submissions.post factory function
  • feat: remove isPreview key from created submissionContent object

Tests

New unit tests have been written for the new functions

Manual tests

  • Submit an email mode form with verified email field, should receive submission as admin, and also submission as form filler
    • Submit with multiple attachments, should receive attachments successfully
  • Submit an storage mode form with verified email field, should receive submission as form filler, should also decrypt successfully
    • Submit with multiple attachments, should decrypt and download successfully
  • Preview email mode form submission, should also be successful
  • Preview encrypt mode form, should also be successful

@karrui karrui changed the title wip: extract public form submission flow to specific Typescript service file feat: extract public form submission flow (and preview) to specific Typescript service file May 19, 2021
@karrui karrui changed the title feat: extract public form submission flow (and preview) to specific Typescript service file feat: extract public form submission flow (and preview) to specific Typescript services May 19, 2021
@karrui karrui force-pushed the feat/client-public-submission-service branch from 8921966 to 5065044 Compare May 19, 2021 09:46
@karrui karrui marked this pull request as ready for review May 19, 2021 09:47
@karrui karrui force-pushed the feat/client-public-submission-service branch from 5065044 to 2b31e6e Compare May 21, 2021 02:30
@karrui
Copy link
Contributor Author

karrui commented May 21, 2021

Ready for review

@karrui
Copy link
Contributor Author

karrui commented May 24, 2021

@mantariksh ready for rerereview

const logMeta = {
action: 'handleEncryptedSubmission',
action: 'submitEncryptModeForm',
Copy link
Contributor

Choose a reason for hiding this comment

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

haha I still prefer the handle* nomenclature in the backend but that's for another day

@karrui karrui merged commit 7233808 into develop May 25, 2021
@karrui karrui deleted the feat/client-public-submission-service branch May 25, 2021 01:59
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.

Extract public-form submission-related functions from submissions.client.factory.js
2 participants