Skip to content

Commit

Permalink
Fix mailing lists view for draft contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Oct 8, 2024
1 parent eb93dfc commit e5e8bae
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/records/ContactMailingListRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
Expand Down
5 changes: 4 additions & 1 deletion src/services/SendoutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit e5e8bae

Please sign in to comment.