Fix checking if post notification email contains any ALC posts

[MAILPOET-2029]
This commit is contained in:
Ján Mikláš
2019-05-14 16:17:01 +02:00
committed by M. Shull
parent c6c9442588
commit 9f21ff1285
3 changed files with 14 additions and 4 deletions

View File

@@ -97,10 +97,9 @@ class Newsletter {
$newsletter
);
}
// check if this is a post notification and if it contains posts
$newsletter_contains_posts = strpos($rendered_newsletter['html'], 'data-post-id');
// check if this is a post notification and if it contains at least 1 ALC post
if ($newsletter->type === NewsletterModel::TYPE_NOTIFICATION_HISTORY &&
!$newsletter_contains_posts
$this->posts_task->getAlcPostsCount($rendered_newsletter, $newsletter) === 0
) {
// delete notification history record since it will never be sent
$newsletter->delete();