Add UserSegments#user_segment_emails helper method
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
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<h2><%= t("admin.newsletters.show.title") %></h2>
|
||||
|
||||
<% recipients_count = @newsletter.valid_segment_recipient? ? @newsletter.list_of_recipients.count : 0 %>
|
||||
<% recipients_count = @newsletter.valid_segment_recipient? ? @newsletter.list_of_recipient_emails.count : 0 %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="callout highlight">
|
||||
|
||||
Reference in New Issue
Block a user