You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a bank saves their organization details (in My Organization -> Edit) we validate not only the organization, but also the Partners. Some partners have legacy data which is invalid, so the whole thing ends up with a 500 error.
For an example from bugsnag, ((direct link example)[https://app.bugsnag.com/ruby-for-good/human-essentials/errors/6703ebb0dab091357e9a2e6e]):
ActiveRecord::RecordInvalid
organizations#update
Validation failed: Pick up email Invalid email address for '/'., Pick up email Invalid email address for 'example1@example.org/example2@otherexample.org'.
| # github.com/rubyforgood/human-essentials/issues/3264
-- | --
| next if organization.send(field)
| organization.partners.each do \|partner\|
| partner.profile.update!(field => organization.send(field))
| end
| end
| end
So the error is that the partner has an invalid email address, since it is actually two email addresses separated by a slash, and we've increased our validation since the data was entered.
This is tricky to reproduce since new Partner data is now validated! So you'll need to force invalid data into a partner to test, and that's how you can do unit test as well.
Expected Behavior
Instead of getting a 500 error on saving the organization details with invalid partner data, show the user the validation error like we would for other organization-level validation errors.
So a flash message with the details of the validation issue.
Steps To Reproduce
Force invalid partner email via the rails console, like partner.update_columns(email: 'not/an/email')
Use the running UI to edit the bank that the partner is associated with
Try to save
Get a 500!!!
Environment
No response
Criteria for Completion
User gets a flash error instead of a 500 when saving an organization with invalid partner data
A unit or request spec that validates this behavior
Anything else?
No response
Code of Conduct
I've read the Code of Conduct and understand my responsibilities as a member of the Ruby for Good community
The text was updated successfully, but these errors were encountered:
I was able to reproduce the issue by setting the partner's profile with an invalid email, like: partner.profile.update_columns(pick_up_email: 'not/an/email').
Setting the partner email to be invalid actually doesn't raise any errors. Currently we're only doing validation during the creation process, not when updating:
Is there an existing issue for this?
Current Behavior
When a bank saves their organization details (in My Organization -> Edit) we validate not only the organization, but also the Partners. Some partners have legacy data which is invalid, so the whole thing ends up with a 500 error.
For an example from bugsnag, ((direct link example)[https://app.bugsnag.com/ruby-for-good/human-essentials/errors/6703ebb0dab091357e9a2e6e]):
So the error is that the partner has an invalid email address, since it is actually two email addresses separated by a slash, and we've increased our validation since the data was entered.
This is tricky to reproduce since new Partner data is now validated! So you'll need to force invalid data into a partner to test, and that's how you can do unit test as well.
Expected Behavior
Instead of getting a 500 error on saving the organization details with invalid partner data, show the user the validation error like we would for other organization-level validation errors.
So a flash message with the details of the validation issue.
Steps To Reproduce
partner.update_columns(email: 'not/an/email')
Environment
No response
Criteria for Completion
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: