Skip to content

Commit 7c61506

Browse files
[2.3-develop] Forwardport of #13044
1 parent b7dc2b3 commit 7c61506

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

app/code/Magento/Newsletter/Model/Subscriber.php

+13-7
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,20 @@ protected function _updateCustomerSubscription($customerId, $subscribe)
592592

593593
$this->save();
594594
$sendSubscription = $sendInformationEmail;
595-
if ($sendSubscription === null xor $sendSubscription) {
595+
if ($sendSubscription === null xor $sendSubscription && $this->isStatusChanged()) {
596596
try {
597-
if ($isConfirmNeed) {
598-
$this->sendConfirmationRequestEmail();
599-
} elseif ($this->isStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
600-
$this->sendUnsubscriptionEmail();
601-
} elseif ($this->isStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
602-
$this->sendConfirmationSuccessEmail();
597+
switch ($status) {
598+
case self::STATUS_UNSUBSCRIBED:
599+
$this->sendUnsubscriptionEmail();
600+
break;
601+
case self::STATUS_SUBSCRIBED:
602+
$this->sendConfirmationSuccessEmail();
603+
break;
604+
case self::STATUS_NOT_ACTIVE:
605+
if ($isConfirmNeed) {
606+
$this->sendConfirmationRequestEmail();
607+
}
608+
break;
603609
}
604610
} catch (MailException $e) {
605611
// If we are not able to send a new account email, this should be ignored

0 commit comments

Comments
 (0)