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

4077 Add the partner's pickup person to the distribution notification #4104

Conversation

isidzukuri
Copy link
Contributor

@isidzukuri isidzukuri commented Feb 12, 2024

Resolves #4077

Description

Add the partner's pickup person to the distribution notification email (if the distribution is pickup).
Note: From the stakeholder meeting 20221207. We have a pickup person email, but they aren't notified

Type of change

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

How Has This Been Tested?

tested with rspec by matching parameters of outgoing email

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.

Thanks for the contribution! Please see comments.

if distribution.pick_up?
pickup_person_email = @partner.profile&.pick_up_email
cc.push(pickup_person_email) if pickup_person_email.present? && pickup_person_email != @partner.email
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably do it more like this:

cc = [@partner.email]
cc.push(@partner.profile&.pick_up_email) if distribution.pick_up?
cc.compact!.uniq!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i like it! Cleaner and more readable. It requires one edit:

    cc = [@partner.email]
    cc.push(@partner.profile&.pick_up_email) if distribution.pick_up?
    cc.compact!
    cc.uniq!

Does it look ok for you?
Im curious which variant works faster. However performance shouldn't be an issue here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed 48c65c2

expect(mail.body.encoded).to match("picked up")
end

context 'when parners profile pick_up_email is present' do
let(:pick_up_email) { 'pick_up@org.com' }
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should be setting this  for non-pickup distributions as well. That way the above tests will validate that it's only going out to the partner, not the pick-up address, when it's not set to pickup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed, please take a look 813b1d9

Im used to write specs in slightly different style, more relying on let instead of instance variables. Please let me know if it does not fit well

@isidzukuri isidzukuri force-pushed the 4077-add-pickup-person-to-the-distribution-notification branch 3 times, most recently from 400050b to 813b1d9 Compare February 13, 2024 06:57
@dorner
Copy link
Collaborator

dorner commented Feb 14, 2024

Looks good to me, but the linter is complaining :)

@isidzukuri
Copy link
Contributor Author

fixed 🏁

@isidzukuri isidzukuri force-pushed the 4077-add-pickup-person-to-the-distribution-notification branch from 2670c1b to d62478e Compare February 15, 2024 23:39
@dorner
Copy link
Collaborator

dorner commented Feb 16, 2024

Thanks. In the future, can you make sure not to force-push your branch? It makes it harder to review only the new commits.

@dorner dorner merged commit d727f65 into rubyforgood:main Feb 16, 2024
@isidzukuri
Copy link
Contributor Author

ok. I used amend to last commit

Copy link
Contributor

@isidzukuri: Your PR 4077 Add the partner's pickup person to the distribution notification is part of today's Human Essentials production release: 2024.02.18.
Thank you very much for your contribution!

@isidzukuri isidzukuri deleted the 4077-add-pickup-person-to-the-distribution-notification branch February 18, 2024 21:12
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.

Add the partner's pickup person to the distribution notification (if the distribution is pickup)
2 participants