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 2, 2024
1 parent ca20652 commit cb5af3f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes for Campaign

## 2.12.2 - Unreleased

### Security

- Improved escaping of table values in the plugins settings.
- Removed the ability to use `contact` and `mailingList` variables in sendout subjects.

## 2.12.1 - 2024-01-08

### 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.12.1",
"version": "2.12.2",
"type": "craft-plugin",
"homepage": "https://putyourlightson.com/plugins/campaign",
"license": "proprietary",
Expand Down
13 changes: 2 additions & 11 deletions src/services/SendoutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,6 @@ public function sendTest(SendoutElement $sendout, ContactElement $contact): bool
// Set the current site from the sendout's site ID
Craft::$app->getSites()->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 @@ -213,7 +210,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 @@ -277,12 +274,6 @@ public function sendEmail(SendoutElement $sendout, ContactElement $contact, int

$mailingList = $mailingListId ? $this->_getMailingListById($mailingListId) : null;

// 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 @@ -317,7 +308,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
1 change: 0 additions & 1 deletion src/templates/_settings/campaigntypes/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
{% for campaignType in craft.campaign.getAllCampaignTypes() %}
{% set tableData = tableData|merge([{
id: campaignType.id,
name: campaignType.name|e,
title: campaignType.name|e,
url: campaignType.cpEditUrl,
handle: campaignType.handle|e,
Expand Down
1 change: 0 additions & 1 deletion src/templates/_settings/mailinglisttypes/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
{% for mailingListType in craft.campaign.getAllMailingListTypes() %}
{% set tableData = tableData|merge([{
id: mailingListType.id,
name: mailingListType.name|e,
title: mailingListType.name|e,
url: mailingListType.cpEditUrl,
handle: mailingListType.handle|e,
Expand Down

0 comments on commit cb5af3f

Please sign in to comment.