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

4486: address pickup email issues #4648

Merged
merged 25 commits into from
Sep 20, 2024

Conversation

panacotar
Copy link
Contributor

@panacotar panacotar commented Sep 12, 2024

Resolves #4486

Description

This PR adds validation for Partner::Profile.pick_up_email. This field is a plain string and the lack of validation caused messy data.

The pick_up_email field should accept multiple comma-separated email addresses, not more than 3, and with optional whitespace between the addresses.
The validation checks this and if every email is in a valid format (using URI::MailTo::EMAIL_REGEXP).

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • added tests for the new pick_up_email model validation in profile_spec.rb
    • bundle exec rspec spec/models/partners/profile_spec.rb or bundle exec rspec spec/models/partners/profile_spec.rb:170
  • updated the distribution_mailer_spec.rb to handle multiple pick_up_email addresses
    • bundle exec rspec spec/mailers/distribution_mailer_spec.rb

I am not experienced with testing and I could definitely use some help, any suggestion is more than welcome.

Screenshots

i4486-1
i4486-2
i4486-3

app/mailers/distribution_mailer.rb Outdated Show resolved Hide resolved
spec/models/partners/profile_spec.rb Outdated Show resolved Hide resolved
@panacotar panacotar changed the title WIP: 4486: address pickup email issues 4486: address pickup email issues Sep 13, 2024
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Non-blocking comment. Thanks for the contribution!

app/models/partners/profile.rb Outdated Show resolved Hide resolved
@dorner
Copy link
Collaborator

dorner commented Sep 13, 2024

@cielf did you want to test?

@cielf
Copy link
Collaborator

cielf commented Sep 13, 2024

@cielf did you want to test?

Yeah, I think I should.

@cielf cielf self-requested a review September 13, 2024 21:44
cielf
cielf previously requested changes Sep 13, 2024
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

@dariuspirvulescu I entered "[email protected]. Call first" when updating a partner profile. It saved it, with no error. That doesn't seem right to me. Similarly "Call first [email protected]"

@cielf
Copy link
Collaborator

cielf commented Sep 15, 2024

[Note: I have not yet done the tests against prod that we need to do before merging.]

@panacotar
Copy link
Contributor Author

panacotar commented Sep 15, 2024

Thanks for testing.
I added more tests, and changed the code. Now it will fail validation for pick_up_email like: "Call first [email protected]" or "[email protected]. Call first".

I'm wondering if you would want me to modify the input component, maybe change "Person's -> Persons" or add a tooltip informing users to comma separate email addresses ([email protected], [email protected])

Screenshot from 2024-09-15 10-30-47

@cielf
Copy link
Collaborator

cielf commented Sep 15, 2024

We should put something about the format.... Maybe just add "(comma-separated if multiple addresses) to the label?

@panacotar
Copy link
Contributor Author

panacotar commented Sep 16, 2024

I modified the label and added a placeholder

4486-4

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

It looks pretty good to me. There's one edge case that I want to check if it exists in the wile (waiting for approval with a bad email address), which will hold this up a bit. (edit we do have one. so need to test with that prod data)

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Hrm. If you already have a bad email it will let you approve (Approving changes the partner record, not the profile record, so it's not re-saving that).

However, there's only one case that has been saved with bad email and is waiting for approval. We can probably live with that -- I can reach out to the bank. @dorner -- are you good with that, or should we make the change?

@dorner
Copy link
Collaborator

dorner commented Sep 20, 2024

I think the bank should be able to fix it if it's just one case.

@cielf
Copy link
Collaborator

cielf commented Sep 20, 2024

(nods) There are other ones that are bad -- just not in that status.

@cielf cielf merged commit 12cebbc into rubyforgood:main Sep 20, 2024
11 checks passed
Copy link
Contributor

@dariuspirvulescu: Your PR 4486: address pickup email issues is part of today's Human Essentials production release: 2024.09.22.
Thank you very much for your contribution!

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.

Address pickup email issues
3 participants