Skip to content

Commit 51d4e67

Browse files
committed
Merge branch 'MDVA-177' into 2.0.5_backlog
2 parents dd496eb + 13ce7b6 commit 51d4e67

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ public function subscribe($email)
399399
$this->setSubscriberConfirmCode($this->randomSequence());
400400
}
401401

402+
$sendConfirmationEmail = true;
403+
if ($this->getStatus() == self::STATUS_SUBSCRIBED && !$this->getCustomerId()) {
404+
$sendConfirmationEmail = false;
405+
}
406+
402407
$isConfirmNeed = $this->_scopeConfig->getValue(
403408
self::XML_PATH_CONFIRMATION_FLAG,
404409
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
@@ -442,12 +447,14 @@ public function subscribe($email)
442447
$this->setStatusChanged(true);
443448

444449
try {
445-
if ($isConfirmNeed === true
446-
&& $isOwnSubscribes === false
447-
) {
448-
$this->sendConfirmationRequestEmail();
449-
} else {
450-
$this->sendConfirmationSuccessEmail();
450+
if ($sendConfirmationEmail === true) {
451+
if ($isConfirmNeed === true
452+
&& $isOwnSubscribes === false
453+
) {
454+
$this->sendConfirmationRequestEmail();
455+
} else {
456+
$this->sendConfirmationSuccessEmail();
457+
}
451458
}
452459
$this->save();
453460
return $this->getStatus();

0 commit comments

Comments
 (0)