Refactor SubscriberActions:subscribe to return status of confirmation email

We need to pass the error or success info about the confirmation email
in order to be able to be able to display the error message.
[MAILPOET-4736]
This commit is contained in:
Rostislav Wolny
2022-11-29 15:41:23 +01:00
committed by Aschepikov
parent 970db8f0d8
commit ee83e4d748
6 changed files with 23 additions and 16 deletions

View File

@ -700,6 +700,7 @@ class Subscriber extends Model {
public static function subscribe($subscriberData = [], $segmentIds = []) {
trigger_error('Calling Subscriber::subscribe() is deprecated and will be removed. Use MailPoet\API\MP\v1\API instead. ', E_USER_DEPRECATED);
$service = ContainerWrapper::getInstance()->get(\MailPoet\Subscribers\SubscriberActions::class);
return $service->subscribe($subscriberData, $segmentIds);
[$subscriber] = $service->subscribe($subscriberData, $segmentIds);
return $subscriber;
}
}