0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added content gating to the mega service

no-issue
This commit is contained in:
Fabien O'Carroll 2019-11-05 11:20:07 +07:00
parent 15ffae211d
commit 84300747a9

View file

@ -8,8 +8,10 @@ const postEmailSerializer = require('./post-email-serializer');
const sendEmail = async (post) => { const sendEmail = async (post) => {
const emailTmpl = postEmailSerializer.serialize(post); const emailTmpl = postEmailSerializer.serialize(post);
const {members} = await membersService.api.members.list(); const {members} = await membersService.api.members.list({limit: 'all'});
const emails = members.map(m => m.email); const emails = members.filter((member) => {
return membersService.contentGating.checkPostAccess(post, member);
}).map(m => m.email);
return bulkEmailService.send(emailTmpl, emails); return bulkEmailService.send(emailTmpl, emails);
}; };