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

Merged
merged 6 commits into from
Feb 16, 2024
Merged

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

merged 6 commits into from
Feb 16, 2024

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) { '[email protected]' }
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 requested a review from dorner February 14, 2024 07:02
@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 requested a review from dorner February 15, 2024 03:41
@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