mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Filtered out members which are unsubscribed in mailing service
This commit is contained in:
parent
1ef015da10
commit
d0bf6e8579
1 changed files with 4 additions and 2 deletions
|
@ -8,12 +8,14 @@ const postEmailSerializer = require('./post-email-serializer');
|
|||
const sendEmail = async (post) => {
|
||||
const emailTmpl = postEmailSerializer.serialize(post);
|
||||
|
||||
const {members} = await membersService.api.members.list({limit: 'all'});
|
||||
const {members} = await membersService.api.members.list(Object.assign({filter: 'subscribed:true'}, {limit: 'all'}));
|
||||
const emails = members.filter((member) => {
|
||||
return membersService.contentGating.checkPostAccess(post, member);
|
||||
}).map(m => m.email);
|
||||
|
||||
return bulkEmailService.send(emailTmpl, emails);
|
||||
if (members.length) {
|
||||
return bulkEmailService.send(emailTmpl, emails);
|
||||
}
|
||||
};
|
||||
|
||||
const sendTestEmail = async (post, emails) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue