Resume sending if API key approved when new FROM address saved
[MAILPOET-2804]
This commit is contained in:
@ -5,8 +5,10 @@ namespace MailPoet\API\JSON\v1;
|
||||
use MailPoet\API\JSON\Endpoint as APIEndpoint;
|
||||
use MailPoet\API\JSON\Error as APIError;
|
||||
use MailPoet\Config\AccessControl;
|
||||
use MailPoet\Config\ServicesChecker;
|
||||
use MailPoet\Cron\Workers\InactiveSubscribers;
|
||||
use MailPoet\Cron\Workers\WooCommerceSync;
|
||||
use MailPoet\Mailer\MailerLog;
|
||||
use MailPoet\Models\Form;
|
||||
use MailPoet\Models\ScheduledTask;
|
||||
use MailPoet\Services\AuthorizedEmailsController;
|
||||
@ -30,6 +32,9 @@ class Settings extends APIEndpoint {
|
||||
/** @var TransactionalEmails */
|
||||
private $wcTransactionalEmails;
|
||||
|
||||
/** @var ServicesChecker */
|
||||
private $servicesChecker;
|
||||
|
||||
public $permissions = [
|
||||
'global' => AccessControl::PERMISSION_MANAGE_SETTINGS,
|
||||
];
|
||||
@ -38,12 +43,14 @@ class Settings extends APIEndpoint {
|
||||
SettingsController $settings,
|
||||
Bridge $bridge,
|
||||
AuthorizedEmailsController $authorizedEmailsController,
|
||||
TransactionalEmails $wcTransactionalEmails
|
||||
TransactionalEmails $wcTransactionalEmails,
|
||||
ServicesChecker $servicesChecker
|
||||
) {
|
||||
$this->settings = $settings;
|
||||
$this->bridge = $bridge;
|
||||
$this->authorizedEmailsController = $authorizedEmailsController;
|
||||
$this->wcTransactionalEmails = $wcTransactionalEmails;
|
||||
$this->servicesChecker = $servicesChecker;
|
||||
}
|
||||
|
||||
public function get() {
|
||||
@ -91,6 +98,10 @@ class Settings extends APIEndpoint {
|
||||
APIError::UNAUTHORIZED => WPFunctions::get()->__('Can’t use this email yet! Please authorize it first.', 'mailpoet'),
|
||||
]);
|
||||
}
|
||||
|
||||
if (MailerLog::isSendingPaused() && !$this->servicesChecker->isMailPoetAPIKeyPendingApproval()) {
|
||||
MailerLog::resumeSending();
|
||||
}
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user