Added periodic "emails" limit check when (re)sending a newsletter

refs https://github.com/TryGhost/Team/issues/588
refs d72ba77aba

- When limit is in place we don't want to allow sending out a new batch of emails if it would go over limit
- See referenced commit for example configuration
This commit is contained in:
Naz 2021-05-07 18:45:14 +04:00
parent d72ba77aba
commit fc458efa90

View File

@ -140,6 +140,10 @@ const addEmail = async (postModel, options) => {
return null;
}
if (limitService.isLimited('emails')) {
await limitService.errorIfWouldGoOverLimit('emails', {addedCount: membersCount});
}
const postId = postModel.get('id');
const existing = await models.Email.findOne({post_id: postId}, knexOptions);