Add authorized emails check to resume sending endpoint
[MAILPOET-1987]
This commit is contained in:
committed by
M. Shull
parent
4c7ad60a72
commit
e7b2b9aee9
@ -6,15 +6,29 @@ use MailPoet\API\JSON\Endpoint as APIEndpoint;
|
||||
use MailPoet\API\JSON\Error as APIError;
|
||||
use MailPoet\Config\AccessControl;
|
||||
use MailPoet\Mailer\MailerLog;
|
||||
use MailPoet\Services\Bridge;
|
||||
use MailPoet\Settings\SettingsController;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Mailer extends APIEndpoint {
|
||||
|
||||
/** @var Bridge */
|
||||
private $bridge;
|
||||
|
||||
/** @var SettingsController */
|
||||
private $settings;
|
||||
|
||||
public $permissions = [
|
||||
'global' => AccessControl::PERMISSION_MANAGE_EMAILS,
|
||||
];
|
||||
|
||||
function __construct(Bridge $bridge, SettingsController $settings) {
|
||||
$this->bridge = $bridge;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
function send($data = []) {
|
||||
try {
|
||||
$mailer = new \MailPoet\Mailer\Mailer(
|
||||
@ -41,6 +55,9 @@ class Mailer extends APIEndpoint {
|
||||
}
|
||||
|
||||
function resumeSending() {
|
||||
if ($this->settings->get(Bridge::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING_NAME)) {
|
||||
$this->bridge->checkAuthorizedEmailAddresses();
|
||||
}
|
||||
MailerLog::resumeSending();
|
||||
return $this->successResponse(null);
|
||||
}
|
||||
|
Reference in New Issue
Block a user