diff --git a/lib/Services/AuthorizedEmailsController.php b/lib/Services/AuthorizedEmailsController.php index b9611f29c8..c5a3a47009 100644 --- a/lib/Services/AuthorizedEmailsController.php +++ b/lib/Services/AuthorizedEmailsController.php @@ -29,9 +29,7 @@ class AuthorizedEmailsController { } function checkAuthorizedEmailAddresses() { - $installed_at = new Carbon($this->settings->get('installed_at')); - $authorized_emails_release_date = new Carbon('2019-03-06'); - if (!Bridge::isMPSendingServiceEnabled() || $installed_at < $authorized_emails_release_date) { + if (!Bridge::isMPSendingServiceEnabled()) { $this->settings->set(self::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING, null); $this->updateMailerLog(); return; diff --git a/tests/integration/Services/AuthorizedEmailsControllerTest.php b/tests/integration/Services/AuthorizedEmailsControllerTest.php index 087cf6ae9f..529d09b742 100644 --- a/tests/integration/Services/AuthorizedEmailsControllerTest.php +++ b/tests/integration/Services/AuthorizedEmailsControllerTest.php @@ -31,15 +31,16 @@ class AuthorizedEmailsControllerTest extends \MailPoetTest { expect($this->settings->get(AuthorizedEmailsController::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING))->null(); } - function testItResetsAuthorisedEmailsErrorIfIntalationDateIsOlderThanAuthEmailsFeature() { + function testItSetsProperErrorForOldUsers() { $this->settings->set('installed_at', '2018-03-04'); + $this->settings->set('sender.address', 'invalid@email.com'); $this->setMailPoetSendingMethod(); - $controller = $this->getController($authorized_emails_from_api = null); + $controller = $this->getController($authorized_emails_from_api = ['auth@email.com']); $controller->checkAuthorizedEmailAddresses(); - expect($this->settings->get(AuthorizedEmailsController::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING))->null(); + expect($this->settings->get(AuthorizedEmailsController::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING))->equals(['invalid_sender_address' => 'invalid@email.com']); } - function testItSetProperErrorForInvalidDefaultSender() { + function testItSetsProperErrorForInvalidDefaultSender() { $this->settings->set('installed_at', new Carbon()); $this->settings->set('sender.address', 'invalid@email.com'); $this->setMailPoetSendingMethod();