mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-02 07:43:11 +03:00
Not creating email record when there is nobody to send it to
This commit is contained in:
parent
7e0da18f85
commit
b364fc5e35
@ -52,6 +52,11 @@ const addEmail = async (post) => {
|
||||
const {members} = await membersService.api.members.list(Object.assign({filter: 'subscribed:true'}, {limit: 'all'}));
|
||||
const {emailTmpl, emails} = getEmailData(post, members);
|
||||
|
||||
// NOTE: don't create email object when there's nobody to send the email to
|
||||
if (!emails.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const existing = await models.Email.findOne({post_id: post.id}, internalContext);
|
||||
|
||||
if (!existing) {
|
||||
|
Loading…
Reference in New Issue
Block a user