Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 9ab75ba

Browse files
committed
updated newsletter subscriber model
1 parent 816ec39 commit 9ab75ba

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,14 +604,19 @@ 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+
break;
615620
}
616621
} catch (MailException $e) {
617622
// If we are not able to send a new account email, this should be ignored

0 commit comments

Comments
 (0)