-
Notifications
You must be signed in to change notification settings - Fork 345
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
Catch all nil emails #151
Catch all nil emails #151
Conversation
At first glance this looks good. I should have a bit more time to review it more thoroughly later today. Thanks for working on it! |
@paulcsmith the current validation logic is designed according to the existing error |
On a second thought, it would actually make more sense if we validate after normalizing the email addresses. Because that way, we get to validate everything, instead of letting unknown types go. Re: If you think it's a good idea, I'll update the PR. |
Ping |
Thanks for the ping. Yes I think validating after normalizing is a good idea. That way we can raise if email address is Please ping again when ready for re-review :) |
555b92f
to
35c7998
Compare
@paulcsmith so I have this wip commit right now, there is one test failing: Hence, I think it's time to ask for clarification. Why did you raise for |
end | ||
|
||
defp is_nil_recipient?({_, nil}), do: true | ||
defp is_nil_recipient?([]), do: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we simply treat empty lists as the same as nil's so we have a unified case?
meaning flipping this false
to true
:)
@princemaple I'll have to take a closer look at the code later, but the reason Basically, it's that sometimes you send to a list of users and that list of users happens to be an empty list. I think this is a valid case and shouldn't raise, it just shouldn't send the email. The comment should explain the logic a bit better. Does that make sense? |
35c7998
to
bc5f0a4
Compare
@paulcsmith I've been busy. I probably don't have time to dig further into this refactor any time soon, so I've deleted the |
I'm going to leave this PR as pure bug fix / edge case elimination. |
@princemaple This is great. Thanks so much and thanks for letting me know where you're at. I'll take a look at this and merge it in soon. Thanks for all your work on this! |
I'm going to try this out one some of our projects on Friday and if all works as expected I'll merge it in :D |
@princemaple I gave this a try and it seemed to work great! Thanks so much for tackling this :) |
Fix #146
@paulcsmith
I was tempted to swap the order of
validate
andnormailize_addresses
, which would reduce a few lines of code, but then I would have to implementBamboo.Formatter
fornil
, which doesn't really make sense.