diff --git a/CHANGELOG.md b/CHANGELOG.md index d9449118..0f56abca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Campaign +## 3.5.4 - 2024-10-08 + +### Fixed + +- Fixed the mailing lists view for draft contacts. + ## 3.5.3 - 2024-10-08 ### Fixed diff --git a/composer.json b/composer.json index a16322ed..c1e8f5b0 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-campaign", "description": "Send and manage email campaigns, contacts and mailing lists.", - "version": "3.5.3", + "version": "3.5.4", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/records/ContactMailingListRecord.php b/src/records/ContactMailingListRecord.php index aeb10d39..9f610d9c 100644 --- a/src/records/ContactMailingListRecord.php +++ b/src/records/ContactMailingListRecord.php @@ -41,13 +41,11 @@ public static function tableName(): string */ public static function find(): ActiveQuery { - // Create a subquery to ensure only contacts and mailing lists that are not drafts not deleted are returned + // Create a subquery to ensure only contacts and mailing lists that not deleted are returned $subquery = parent::find() ->innerJoin(Table::ELEMENTS . ' contactElement', '[[contactElement.id]] = [[contactId]]') ->innerJoin(Table::ELEMENTS . ' mailingListElement', '[[mailingListElement.id]] = [[mailingListId]]') ->where([ - 'contactElement.draftId' => null, - 'mailingListElement.draftId' => null, 'contactElement.dateDeleted' => null, 'mailingListElement.dateDeleted' => null, ]); diff --git a/src/services/SendoutsService.php b/src/services/SendoutsService.php index b1d52fea..32f434e1 100755 --- a/src/services/SendoutsService.php +++ b/src/services/SendoutsService.php @@ -121,7 +121,10 @@ public function getPendingRecipients(SendoutElement $sendout, int $limit = null) public function getPendingRecipientCount(SendoutElement $sendout): int { if ($sendout->sendoutType === 'regular') { - $count = count($this->getPendingRecipientsStandardIds($sendout)); + // Count live contacts only (not drafts). + $count = ContactElement::find() + ->id($this->getPendingRecipientsStandardIds($sendout)) + ->count(); } else { $count = count($this->getPendingRecipients($sendout)); }