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

Fix #6117 handle duplicate contact types #6119

Merged

Conversation

thejonroberts
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #6117

What changed, and why?

See Issue and/or bugsnag

Duplicate contact type ids are being shown in the form, due to a join... And if they are sent in request, it will fail because of a unique validation.

This PR:

  • adds logic in CaseContactParams class to remove duplicate contact type ids in the request. This is the "main" fix.
  • adds .distinct calls when contact types are queried for the form. This should prevent the form showing repeated contact types, and prevent the 'bad' request from happening. Not necessary to stop the error, but a better user experience.
  • adds request spec for duplicate type ids in request params. The setup gave the same error seen in bugsnag before the fixes above were applied.

How is this tested? (please write tests!) 💖💪

Third bullet point above. I didn't figure out how the production data resulted in duplication in the form, so I did not make a 'frontend' spec.

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Dec 4, 2024
@compwron compwron enabled auto-merge December 9, 2024 19:57
@compwron compwron merged commit 6597e4f into rubyforgood:main Dec 9, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Case Contact Form Validation failure
2 participants