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

feat: remove duplicate emails ignoring case in Personalization #924

Open
wants to merge 2 commits into
base: main
from

Conversation

@DougCal
Copy link
Contributor

@DougCal DougCal commented Jul 20, 2020

Fixes #788

This removes duplicate emails on setting the Personalization object, ignoring case.

@DougCal
Copy link
Contributor Author

@DougCal DougCal commented Jul 20, 2020

The setters currently don't work for lists of strings or lists of tuples. Wasn't sure if they're needed for this feature, but let me know what you think of them and the expected behavior for if they're used. At the moment, this will raise an AttributionError.

@thinkingserious thinkingserious changed the base branch from master to main Jul 28, 2020
@childish-sambino childish-sambino changed the title remove duplicate emails ignoring case in Personalization feat: remove duplicate emails ignoring case in Personalization Nov 9, 2020
Copy link
Contributor

@eshanholtz eshanholtz left a comment

Generally this looks good, but doesn't work when using just the add_to/add_cc/add_bcc functions:

p = Personalization()
to_email = To('test+to@example.com', 'Example To Name 0')
p.add_to(to_email)
p.add_to(to_email)

Since there are several ways of setting/adding emails to these fields, and each set would result in a call to _get_unique_recipients, why not just use that function once in each of the getters? For example:

@property
def tos(self):
   return _get_unique_recipients(self._tos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.