Skip to content

Commit

Permalink
Reset duplicate campaign stats
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Nov 29, 2024
1 parent 3a77b2f commit fdda031
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 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

## 2.17.8 - 2024-11-29

### Fixed

- Fixed a bug in which duplicating campaigns was not resetting the new campaign’s stats.

## 2.17.7 - 2024-10-31

### Changed
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": "2.17.7",
"version": "2.17.8",
"type": "craft-plugin",
"homepage": "https://putyourlightson.com/plugins/campaign",
"license": "proprietary",
Expand Down
2 changes: 1 addition & 1 deletion src/elements/CampaignElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ protected function statusFieldHtml(): string
public function beforeSave(bool $isNew): bool
{
// Reset stats if this is a duplicate of a non-draft campaign.
if ($this->firstSave && $this->duplicateOf !== null) {
if ($isNew && $this->getIsCanonical() && $this->duplicateOf !== null) {
$this->recipients = 0;
$this->opened = 0;
$this->clicked = 0;
Expand Down

0 comments on commit fdda031

Please sign in to comment.