Skip to content

Prevented duplicates when adding Tos, CCs, BCCs #691 - #939

Closed
ErikJ1 wants to merge 2 commits into
sendgrid:masterfrom
ErikJ1:691-duplicate-recipients
Closed

ErikJ1 wants to merge 2 commits into
sendgrid:masterfrom
ErikJ1:691-duplicate-recipients

Conversation

@ErikJ1

@ErikJ1 ErikJ1 commented Oct 4, 2019 •

Copy link
Copy Markdown

Fixes #691

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the [Contribution Guide] and my PR follows them.
  • I updated my branch with the development branch.
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added in line documentation to the code I modified

Short description of what this PR does:

If you have questions, please send an email to Twilio Sendgrid, or file a Github Issue in this repository.

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Oct 4, 2019

@aevitas aevitas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think some of these changes could be expressed less verbose using Contains and Distinct(). As it stands, there are too many different comparisons going on to determine equality.

@ErikJ1

ErikJ1 commented Oct 4, 2019 •

Copy link
Copy Markdown
Author

Pushed equality comparisons for preventing email address duplicates into its own IEqualityComparer-derived class. This should satisfy above concerns stated by @aevitas .

return false;
}

return !string.IsNullOrWhiteSpace(x.Email) && StringComparer.OrdinalIgnoreCase.Equals(x.Email, y.Email);

@jamespedid jamespedid Nov 1, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Sendgrid API also fails on things like somebody@mymail.com' and 'Somebody <somebody@mymail.com>'. Your comparison here isn't necessarily good enough,

@childish-sambino

Copy link
Copy Markdown
Contributor

Closing in favor of #991

@childish-sambino childish-sambino added status: duplicate duplicate issue and removed status: code review request requesting a community code review or review from Twilio labels Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: duplicate duplicate issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No email is sent when recipient email is duplicated

6 participants