Remove empty emails from users segments recipients
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.
This commit is contained in:
@@ -13,6 +13,6 @@ class Admin::EmailsDownloadController < Admin::BaseController
|
||||
private
|
||||
|
||||
def users_segment_emails_csv(users_segment)
|
||||
UserSegments.send(users_segment).newsletter.pluck(:email).to_csv
|
||||
UserSegments.send(users_segment).newsletter.pluck(:email).compact.join(',')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user