Skip to content

Commit b106ee8

Browse files
MAGETWO-86562: Fix Newsletter Subscribe Workflow #13044
2 parents 0d9b972 + 75fb093 commit b106ee8

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)