Skip to content

Commit

Permalink
Remove render string usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Mar 5, 2024
1 parent 39ce917 commit 602ee31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Release Notes for Campaign

## 1.25.1 - Unreleased
## 1.25.1 - 2024-03-05
### Changed
- Logs are now output to the Craft log, in addition to the Campaign log file.

### Security
- Removed the ability to use `contact` and `mailingList` variables in sendout subjects.

## 1.25.0 - 2023-11-09
### Added
- Added the `sendoutJobPriority` config setting ([#433](https://github.com/putyourlightson/craft-campaign/issues/433)).
Expand Down
13 changes: 2 additions & 11 deletions src/services/SendoutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,6 @@ public function sendTest(SendoutElement $sendout, ContactElement $contact): bool
// Set the current site from the sendout's site ID
Craft::$app->sites->setCurrentSite($sendout->siteId);

// Get subject
$subject = Craft::$app->getView()->renderString($sendout->subject, ['contact' => $contact]);

// Get body, catching template rendering errors
try {
$htmlBody = $campaign->getHtmlBody($contact, $sendout);
Expand All @@ -330,7 +327,7 @@ public function sendTest(SendoutElement $sendout, ContactElement $contact): bool
$message = Campaign::$plugin->mailer->compose()
->setFrom([$sendout->fromEmail => $sendout->fromName])
->setTo($contact->email)
->setSubject('[Test] '.$subject)
->setSubject('[Test] '.$sendout->subject)
->setHtmlBody($htmlBody)
->setTextBody($plaintextBody);

Expand Down Expand Up @@ -400,12 +397,6 @@ public function sendEmail(SendoutElement $sendout, ContactElement $contact, int

$mailingList = $this->_getMailingList($mailingListId);

// Get subject
$subject = Craft::$app->getView()->renderString($sendout->subject, [
'contact' => $contact,
'mailingList' => $mailingList,
]);

// Get body, catching template rendering errors
try {
$htmlBody = $campaign->getHtmlBody($contact, $sendout, $mailingList);
Expand Down Expand Up @@ -440,7 +431,7 @@ public function sendEmail(SendoutElement $sendout, ContactElement $contact, int
$message = Campaign::$plugin->mailer->compose()
->setFrom([$sendout->fromEmail => $sendout->fromName])
->setTo($contact->email)
->setSubject($subject)
->setSubject($sendout->subject)
->setHtmlBody($htmlBody)
->setTextBody($plaintextBody);

Expand Down

0 comments on commit 602ee31

Please sign in to comment.