Send confirmation email when there are unconfirmed data

[MAILPOET-3649]
This commit is contained in:
Jan Lysý
2021-06-24 17:42:50 +02:00
committed by Veljko V
parent 6773c42131
commit 9b51f4e70e
2 changed files with 4 additions and 4 deletions

View File

@ -177,8 +177,8 @@ class Pages {
);
}
// Send new subscriber notification only when status changes to subscribed to avoid spamming
if ($originalStatus !== Subscriber::STATUS_SUBSCRIBED) {
// Send new subscriber notification only when status changes to subscribed or there are unconfirmed data to avoid spamming
if ($originalStatus !== Subscriber::STATUS_SUBSCRIBED || $subscriberData !== null) {
$this->newSubscriberNotificationSender->send($this->subscriber, $subscriberSegments);
}

View File

@ -75,7 +75,7 @@ class PagesTest extends \MailPoetTest {
$subscriber = $this->subscriber;
$subscriber->setStatus(Subscriber::STATUS_SUBSCRIBED);
$subscriber->setFirstName('First name');
$subscriber->setUnconfirmedData('{"first_name" : "Updated first name", "email" : "' . $this->subscriber->getEmail() . '"}');
$subscriber->setUnconfirmedData(null);
$subscriber->setLastSubscribedAt(Carbon::createFromTimestamp($this->wp->currentTime('timestamp'))->subDays(10));
$subscriber->setConfirmedIp(Carbon::createFromTimestamp($this->wp->currentTime('timestamp'))->subDays(10));
$this->entityManager->flush();
@ -89,7 +89,7 @@ class PagesTest extends \MailPoetTest {
expect($confirmedSubscriber->getConfirmedAt())->lessOrEquals(Carbon::createFromTimestamp($this->wp->currentTime('timestamp'))->addSecond());
expect($confirmedSubscriber->getLastSubscribedAt())->greaterOrEquals(Carbon::createFromTimestamp($this->wp->currentTime('timestamp'))->subSecond());
expect($confirmedSubscriber->getLastSubscribedAt())->lessOrEquals(Carbon::createFromTimestamp($this->wp->currentTime('timestamp'))->addSecond());
expect($confirmedSubscriber->getFirstName())->equals('Updated first name');
expect($confirmedSubscriber->getFirstName())->equals('First name');
}
public function testItSendsWelcomeNotificationUponConfirmingSubscription() {