Move MSS Activation to change handler
[MAILPOET-4061]
This commit is contained in:
committed by
Veljko V
parent
00f3e3787d
commit
5f5255f921
@@ -208,7 +208,7 @@ class Settings extends APIEndpoint {
|
||||
$oldSendingMethod = $oldSettings['mta_group'];
|
||||
$newSendingMethod = $newSettings['mta_group'];
|
||||
if (($oldSendingMethod !== $newSendingMethod) && ($newSendingMethod === 'mailpoet')) {
|
||||
$this->onMSSActivate($newSettings);
|
||||
$this->settingsChangeHandler->onMSSActivate($newSettings);
|
||||
}
|
||||
|
||||
// Sync WooCommerce Customers list
|
||||
@@ -227,23 +227,6 @@ class Settings extends APIEndpoint {
|
||||
}
|
||||
}
|
||||
|
||||
private function onMSSActivate($newSettings) {
|
||||
// see mailpoet/assets/js/src/wizard/create_sender_settings.jsx:freeAddress
|
||||
$domain = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
||||
if (
|
||||
isset($newSettings['sender']['address'])
|
||||
&& !empty($newSettings['reply_to']['address'])
|
||||
&& ($newSettings['sender']['address'] === ('wordpress@' . $domain))
|
||||
) {
|
||||
$sender = [
|
||||
'name' => $newSettings['reply_to']['name'] ?? '',
|
||||
'address' => $newSettings['reply_to']['address'],
|
||||
];
|
||||
$this->settings->set('sender', $sender);
|
||||
$this->settings->set('reply_to', null);
|
||||
}
|
||||
}
|
||||
|
||||
public function recalculateSubscribersCountsCache() {
|
||||
$segments = $this->segmentsRepository->findAll();
|
||||
foreach ($segments as $segment) {
|
||||
|
Reference in New Issue
Block a user