From 9ecf7574eb5477c4975b585f9520c9e911cd2358 Mon Sep 17 00:00:00 2001 From: Ben Croker Date: Wed, 20 Sep 2023 10:09:05 +0200 Subject: [PATCH] 1.24.4 --- CHANGELOG.md | 7 +++++-- composer.json | 2 +- src/services/SendoutsService.php | 13 ++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a325e72..a1c19214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ # Release Notes for Campaign -## 1.24.3 - 2023-08-21 +## 1.24.4 - 2023-09-20 +### Fixed +- Fixed a bug in which the cached sendout element view was not invalidated after a sendout completed ([#416](https://github.com/putyourlightson/craft-campaign/issues/416)). +## 1.24.3 - 2023-08-21 ### Added - - Added the `has a value` and `is empty` options to segment conditions ([#407](https://github.com/putyourlightson/craft-campaign/issues/407)). + ## 1.24.2 - 2023-06-01 - Added logging of sendout batches and when a sendout completes ([#385](https://github.com/putyourlightson/craft-campaign/issues/385)). diff --git a/composer.json b/composer.json index 79a4b4bc..4532890c 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": "1.24.3", + "version": "1.24.4", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/services/SendoutsService.php b/src/services/SendoutsService.php index 36dce54c..5565cf7a 100644 --- a/src/services/SendoutsService.php +++ b/src/services/SendoutsService.php @@ -8,6 +8,7 @@ use craft\helpers\DateTimeHelper; use craft\helpers\StringHelper; use craft\queue\Queue; +use craft\services\Elements; use craft\web\View; use DateTime; use DOMDocument; @@ -791,7 +792,17 @@ private function _updateSendoutRecord(SendoutElement $sendout, array $fields): b // Set attributes from sendout's fields $sendoutRecord->setAttributes($sendout->toArray($fields), false); - return $sendoutRecord->save(); + if (!$sendoutRecord->save()) { + return false; + } + + // Invalidate caches for the sendout, since the update may have been + // made programmatically. + if (method_exists(Craft::$app->getElements(), 'invalidateCachesForElement')) { + Craft::$app->getElements()->invalidateCachesForElement($sendout); + } + + return true; } /**