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

Remove empty emails from user segment usages #2516

Merged
merged 2 commits into from
Mar 5, 2018
Merged

Conversation

bertocq
Copy link
Collaborator

@bertocq bertocq commented Mar 5, 2018

References

Objectives

  • Remove empty emails (users without a email value) from Email Download lists and Newsletter email recipients.

  • Increase feature specs to cover all possible scenarios.

Visual Changes (if any)

None

Deployment & Warnings

None

Why:

User with an empty email value (nil) should not appear in the recipient
list for a given UserSegment at Newsletters or Email Downloads.

How:

Using Enumerable#compact and Enumerable#select to filter out empty emails

Increasing Email Download feature spec and Newsletter model spec to cover
all possible scenarios including the nil email one.
Why:

Both Newsletters and Email Downloads need the same logic: To extract the
emails from all the users in the segment that have newsletter flag
active, removing all empty email values.

How:

1- UserSegments#user_segment_emails holds that repeated logic and is used
on both Newsletter & EmailDownload.

2- Rename Newsletter#list_of_recipients to list_of_recipient_emails as
it is more descriptive. There is no need to pass entire Users around,
only the emails are needed at Mailer#newsletter method.

3- Cleanup Newsletter#list_of_recipient_emails model spec scenario
@bertocq
Copy link
Collaborator Author

bertocq commented Mar 5, 2018

Tested at madrid's fork servers 👌

@bertocq bertocq merged commit 28eab38 into master Mar 5, 2018
@bertocq bertocq deleted the fix_user_segment_emails branch March 5, 2018 13:08
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.

None yet

2 participants