Fetch only subscribed recipients when sending a newsletter

[MAILPOET-4166]
This commit is contained in:
Rostislav Wolny
2022-02-28 14:00:37 +01:00
committed by Veljko V
parent 3316a2a3f8
commit 6a6c04f168
2 changed files with 40 additions and 1 deletions

View File

@@ -185,7 +185,7 @@ class SendingQueue {
if (!empty($newsletterSegmentsIds[0])) {
// Check that subscribers are in segments
$foundSubscribersIds = $this->subscribersFinder->findSubscribersInSegments($subscribersToProcessIds, $newsletterSegmentsIds);
$foundSubscribers = SubscriberModel::whereIn('id', $subscribersToProcessIds)
$foundSubscribers = empty($foundSubscribersIds) ? [] : SubscriberModel::whereIn('id', $foundSubscribersIds)
->whereNull('deleted_at')
->findMany();
} else {