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

Model validators not running for settings page updates #1803

Closed
mantariksh opened this issue May 5, 2021 · 2 comments
Closed

Model validators not running for settings page updates #1803

mantariksh opened this issue May 5, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@mantariksh
Copy link
Contributor

mantariksh commented May 5, 2021

To replicate on staging:

  1. on staging, add a valid collaborator to a form
  2. in the database, edit this collaborator’s to have a non-whitelisted domain (e.g. @nonsense.gov.sg)
  3. try adding a form field. this should fail because we correctly run model validators when adding form fields.
  4. try editing the settings page (e.g. toggle captcha). the update goes through because the model validators aren’t running.
@mantariksh mantariksh added the bug Something isn't working label May 5, 2021
@mantariksh
Copy link
Contributor Author

This is because Mongoose only runs the validator for the specific path being updated when we call findByIdAndUpdate. To discuss whether this is expected behaviour or not.

@mantariksh
Copy link
Contributor Author

This is expected behaviour. Closing in favour of #1814.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant