Skip to content

Commit

Permalink
Fixed the unsubscribe webhook action
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Oct 28, 2022
1 parent bf2335f commit dbd2f78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Campaign

## 2.1.17 - 2022-10-28
### Fixed
- Fixed a bug in which the unsubscribe webhook action could throw an exception ([#339](https://github.com/putyourlightson/craft-campaign/issues/339)).

## 2.1.16 - 2022-10-27
### Fixed
- Fixed all remaining uninitialized typed properties, as a precaution.
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.1.16",
"version": "2.1.17",
"type": "craft-plugin",
"homepage": "https://putyourlightson.com/plugins/campaign",
"license": "proprietary",
Expand Down
5 changes: 2 additions & 3 deletions src/services/WebhookService.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ private function _addInteraction(ContactElement $contact, string $interaction):
}
}

// Update contact
if (empty($contact->{$interaction})) {
// Update contact if the interaction exists on it
if (property_exists($contact, $interaction) && empty($contact->{$interaction})) {
$contact->{$interaction} = new DateTime();

Craft::$app->getElements()->saveElement($contact);
}
}
Expand Down

0 comments on commit dbd2f78

Please sign in to comment.