Remove the feature flag [MAILPOET-1983]

This commit is contained in:
wxa
2019-05-06 16:48:24 +03:00
committed by M. Shull
parent 20f3ce79e6
commit 2980bbf00b
15 changed files with 3 additions and 36 deletions

View File

@ -62,9 +62,7 @@ class Changelog {
$this->setupNewInstallation(); $this->setupNewInstallation();
$this->checkWelcomeWizard(); $this->checkWelcomeWizard();
} }
if ($this->settings->get('woo_commerce_list_sync_enabled')) { $this->checkWooCommerceListImportPage();
$this->checkWooCommerceListImportPage();
}
} }
private function checkMp2Migration($version) { private function checkMp2Migration($version) {

View File

@ -163,10 +163,6 @@ class Hooks {
} }
function setupWooCommerceSubscriptionEvents() { function setupWooCommerceSubscriptionEvents() {
if (!$this->settings->get('woo_commerce_list_sync_enabled')) {
return false;
}
$woocommerce = $this->settings->get('woocommerce', []); $woocommerce = $this->settings->get('woocommerce', []);
// WooCommerce: subscribe on checkout // WooCommerce: subscribe on checkout
if (!empty($woocommerce['optin_on_checkout']['enabled'])) { if (!empty($woocommerce['optin_on_checkout']['enabled'])) {

View File

@ -408,9 +408,6 @@ class Menu {
} }
function wooCommerceListImport() { function wooCommerceListImport() {
if (!$this->settings->get('woo_commerce_list_sync_enabled')) {
return;
}
if ((bool)(defined('DOING_AJAX') && DOING_AJAX)) return; if ((bool)(defined('DOING_AJAX') && DOING_AJAX)) return;
$data = [ $data = [
'finish_wizard_url' => $this->wp->adminUrl('admin.php?page=' . self::MAIN_PAGE_SLUG), 'finish_wizard_url' => $this->wp->adminUrl('admin.php?page=' . self::MAIN_PAGE_SLUG),

View File

@ -56,8 +56,6 @@ class Daemon {
yield $this->workers_factory->createBounceWorker($this->timer); yield $this->workers_factory->createBounceWorker($this->timer);
yield $this->workers_factory->createExportFilesCleanupWorker($this->timer); yield $this->workers_factory->createExportFilesCleanupWorker($this->timer);
yield $this->workers_factory->createInactiveSubscribersWorker($this->timer); yield $this->workers_factory->createInactiveSubscribersWorker($this->timer);
if ($this->settings_controller->get('woo_commerce_list_sync_enabled')) { yield $this->workers_factory->createWooCommerceSyncWorker($this->timer);
yield $this->workers_factory->createWooCommerceSyncWorker($this->timer);
}
} }
} }

View File

@ -25,9 +25,6 @@ class WooCommerce {
} }
function synchronizeRegisteredCustomer($wp_user_id, $current_filter = null) { function synchronizeRegisteredCustomer($wp_user_id, $current_filter = null) {
if (!$this->settings->get('woo_commerce_list_sync_enabled')) {
return false;
}
$wc_segment = Segment::getWooCommerceSegment(); $wc_segment = Segment::getWooCommerceSegment();
if ($wc_segment === false) return; if ($wc_segment === false) return;
@ -76,9 +73,6 @@ class WooCommerce {
} }
function synchronizeGuestCustomer($order_id, $current_filter = null) { function synchronizeGuestCustomer($order_id, $current_filter = null) {
if (!$this->settings->get('woo_commerce_list_sync_enabled')) {
return false;
}
$wc_order = $this->wp->getPost($order_id); $wc_order = $this->wp->getPost($order_id);
$wc_segment = Segment::getWooCommerceSegment(); $wc_segment = Segment::getWooCommerceSegment();

View File

@ -100,11 +100,6 @@ class Settings {
return $this; return $this;
} }
function withWooCommerceListSyncEnabled() {
$this->settings->set('woo_commerce_list_sync_enabled', 1);
return $this;
}
function withWooCommerceCheckoutOptinEnabled() { function withWooCommerceCheckoutOptinEnabled() {
$this->settings->set('woocommerce.optin_on_checkout.enabled', true); $this->settings->set('woocommerce.optin_on_checkout.enabled', true);
$this->settings->set('woocommerce.optin_on_checkout.message', 'Yes, I would like to be added to your mailing list'); $this->settings->set('woocommerce.optin_on_checkout.message', 'Yes, I would like to be added to your mailing list');

View File

@ -21,7 +21,6 @@ class WooCommerceCheckoutOptinCest {
$this->product_factory = new WooCommerceProduct($I); $this->product_factory = new WooCommerceProduct($I);
$this->settings_factory = new Settings(); $this->settings_factory = new Settings();
$this->settings_factory->withWooCommerceListImportPageDisplayed(true); $this->settings_factory->withWooCommerceListImportPageDisplayed(true);
$this->settings_factory->withWooCommerceListSyncEnabled();
$this->settings_factory->withWooCommerceCheckoutOptinEnabled(); $this->settings_factory->withWooCommerceCheckoutOptinEnabled();
} }

View File

@ -22,7 +22,6 @@ class WooCommerceCustomerListCest {
$this->product_factory = new WooCommerceProduct($I); $this->product_factory = new WooCommerceProduct($I);
$settings_factory = new Settings(); $settings_factory = new Settings();
$settings_factory->withWooCommerceListImportPageDisplayed(true); $settings_factory->withWooCommerceListImportPageDisplayed(true);
$settings_factory->withWooCommerceListSyncEnabled();
$settings_factory->withWooCommerceCheckoutOptinEnabled(); $settings_factory->withWooCommerceCheckoutOptinEnabled();
$customer_factory = new WooCommerceCustomer($I); $customer_factory = new WooCommerceCustomer($I);
$customer_factory->deleteAll(); $customer_factory->deleteAll();

View File

@ -27,9 +27,6 @@ class WooCommerceListImportPageCest {
// Cleanup // Cleanup
$this->customer_factory->deleteAll(); $this->customer_factory->deleteAll();
$this->order_factory->deleteAll(); $this->order_factory->deleteAll();
// Feature switch
$settings_factory = new Settings();
$settings_factory->withWooCommerceListSyncEnabled();
$scheduled_tasks_factory = new ScheduledTask(); $scheduled_tasks_factory = new ScheduledTask();
$scheduled_tasks_factory->deleteAll(); $scheduled_tasks_factory->deleteAll();
} }

View File

@ -12,7 +12,6 @@ class WooCommerceSettingsTabCest {
$I->activateWooCommerce(); $I->activateWooCommerce();
$this->settings_factory = new Settings(); $this->settings_factory = new Settings();
$this->settings_factory->withWooCommerceListImportPageDisplayed(true); $this->settings_factory->withWooCommerceListImportPageDisplayed(true);
$this->settings_factory->withWooCommerceListSyncEnabled();
} }
function checkWooCommerceTabExists(\AcceptanceTester $I) { function checkWooCommerceTabExists(\AcceptanceTester $I) {

View File

@ -17,7 +17,6 @@ class DaemonTest extends \MailPoetTest {
public function _before() { public function _before() {
parent::_before(); parent::_before();
$this->settings = new SettingsController(); $this->settings = new SettingsController();
$this->settings->set('woo_commerce_list_sync_enabled', 1);
} }
function testItCanRun() { function testItCanRun() {

View File

@ -27,7 +27,6 @@ class WooCommerceTest extends \MailPoetTest {
function _before() { function _before() {
$this->woocommerce_segment = ContainerWrapper::getInstance()->get(WooCommerceSegment::class); $this->woocommerce_segment = ContainerWrapper::getInstance()->get(WooCommerceSegment::class);
$this->settings = ContainerWrapper::getInstance()->get(SettingsController::class); $this->settings = ContainerWrapper::getInstance()->get(SettingsController::class);
$this->settings->set('woo_commerce_list_sync_enabled', 1);
$this->cleanData(); $this->cleanData();
$this->addCustomerRole(); $this->addCustomerRole();
} }

View File

@ -15,7 +15,6 @@ class SubscriptionTest extends \MailPoetTest {
$this->order_id = 123; // dummy $this->order_id = 123; // dummy
$this->subscription = ContainerWrapper::getInstance()->get(Subscription::class); $this->subscription = ContainerWrapper::getInstance()->get(Subscription::class);
$this->settings = new SettingsController(); $this->settings = new SettingsController();
$this->settings->set('woo_commerce_list_sync_enabled', 1);
$this->wc_segment = Segment::getWooCommerceSegment(); $this->wc_segment = Segment::getWooCommerceSegment();
$subscriber = Subscriber::create(); $subscriber = Subscriber::create();

View File

@ -117,7 +117,7 @@
} else { } else {
$('#settings_stats_notifications_error').hide(); $('#settings_stats_notifications_error').hide();
} }
<% if is_woocommerce_active and settings.woo_commerce_list_sync_enabled %> <% if is_woocommerce_active %>
// if WooCommerce opt-in on checkout is enabled but the checkbox message is empty, show an error // if WooCommerce opt-in on checkout is enabled but the checkbox message is empty, show an error
var woocommerce_optin_on_checkout_enabled = $('input[name="woocommerce[optin_on_checkout][enabled]"]:checked').val(), var woocommerce_optin_on_checkout_enabled = $('input[name="woocommerce[optin_on_checkout][enabled]"]:checked').val(),
woocommerce_optin_on_checkout_message = $('input[name="woocommerce[optin_on_checkout][message]"]').val().trim(); woocommerce_optin_on_checkout_message = $('input[name="woocommerce[optin_on_checkout][message]"]').val().trim();

View File

@ -1,5 +1,4 @@
<table class="form-table"> <table class="form-table">
<% if settings.woo_commerce_list_sync_enabled %>
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="settings[woocommerce_optin_on_checkout]"> <label for="settings[woocommerce_optin_on_checkout]">
@ -46,7 +45,6 @@
</p> </p>
</td> </td>
</tr> </tr>
<% endif %>
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="settings[mailpoet_subscribe_old_woocommerce_customers]"> <label for="settings[mailpoet_subscribe_old_woocommerce_customers]">