Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Apr 14, 2024
1 parent c801a5b commit 1716ace
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/services/SendoutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use DOMDocument;
use DOMElement;
use putyourlightson\campaign\Campaign;
use putyourlightson\campaign\controllers\TrackerController;
use putyourlightson\campaign\elements\ContactElement;
use putyourlightson\campaign\elements\MailingListElement;
use putyourlightson\campaign\elements\SendoutElement;
Expand Down Expand Up @@ -101,17 +100,6 @@ public function getSendoutBySid(string $sid): ?SendoutElement
return $this->getSendoutById($sendoutId);
}

/**
* Returns sendout send status by ID.
*/
public function getSendoutSendStatusById(int $sendoutId): bool|string|null
{
return SendoutRecord::find()
->select(['sendStatus'])
->where(['id' => $sendoutId])
->scalar();
}

/**
* Returns the sendout’s pending recipients.
*/
Expand Down Expand Up @@ -313,17 +301,13 @@ public function sendEmail(SendoutElement $sendout, ContactElement $contact, int
Campaign::$plugin->mailer->useFileTransport = true;
}

/**
* Use the one-click unsubscribe controller action.
*
* @see TrackerController::actionOneClickUnsubscribe()
*/
$oneClickUnsubscribeUrl = str_replace('campaign/t/unsubscribe', 'campaign/t/one-click-unsubscribe', $contact->getUnsubscribeUrl($sendout));

/** @var Message $message */
$message = Campaign::$plugin->mailer->compose();

if (Campaign::$plugin->settings->addOneClickUnsubscribeHeaders) {
// Use the one-click unsubscribe controller action.
$oneClickUnsubscribeUrl = str_replace('campaign/t/unsubscribe', 'campaign/t/one-click-unsubscribe', $contact->getUnsubscribeUrl($sendout));

$message->setHeader('List-Unsubscribe-Post', 'List-Unsubscribe=One-Click')
->setHeader('List-Unsubscribe', $oneClickUnsubscribeUrl);
}
Expand Down

0 comments on commit 1716ace

Please sign in to comment.