Skip to content

Commit 75fb093

Browse files
committed
MAGETWO-86562: Fix Newsletter Subscribe Workflow magento#13044
- Merge Pull Request magento#13044 from torhoehn/magento2:newsletter-fix - Merged commits: 1. 9ab75ba 2. 93453a8
2 parents 5790c16 + 93453a8 commit 75fb093

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)