Skip to content

Commit 63b4839

Browse files
Merge forwardport of #13044 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/13044.patch (created by @torhoehn) based on commit(s): 1. 9ab75ba 2. 93453a8 Fixed GitHub Issues in 2.3-develop branch: - #12876: Multiple newsletter confirmation emails sent (reported by @nfourteen)
2 parents 6114120 + 7c61506 commit 63b4839

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,14 +604,20 @@ protected function _updateCustomerSubscription($customerId, $subscribe)
604604

605605
$this->save();
606606
$sendSubscription = $sendInformationEmail;
607-
if ($sendSubscription === null xor $sendSubscription) {
607+
if ($sendSubscription === null xor $sendSubscription && $this->isStatusChanged()) {
608608
try {
609-
if ($isConfirmNeed) {
610-
$this->sendConfirmationRequestEmail();
611-
} elseif ($this->isStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
612-
$this->sendUnsubscriptionEmail();
613-
} elseif ($this->isStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
614-
$this->sendConfirmationSuccessEmail();
609+
switch ($status) {
610+
case self::STATUS_UNSUBSCRIBED:
611+
$this->sendUnsubscriptionEmail();
612+
break;
613+
case self::STATUS_SUBSCRIBED:
614+
$this->sendConfirmationSuccessEmail();
615+
break;
616+
case self::STATUS_NOT_ACTIVE:
617+
if ($isConfirmNeed) {
618+
$this->sendConfirmationRequestEmail();
619+
}
620+
break;
615621
}
616622
} catch (MailException $e) {
617623
// If we are not able to send a new account email, this should be ignored

0 commit comments

Comments
 (0)