Remove the WC customizer feature flag [MAILPOET-2285]

This commit is contained in:
wxa
2019-12-24 10:16:31 +03:00
committed by wxa
parent 9fdd37dbd8
commit 20d42af4dc
8 changed files with 4 additions and 56 deletions

View File

@ -69,7 +69,7 @@ class NewsletterTypes extends React.Component {
}
getAdditionalTypes = () => {
const show = window.mailpoet_woocommerce_active && MailPoet.FeaturesController.isSupported('wc-transactional-emails-customizer');
const show = window.mailpoet_woocommerce_active;
if (!show) {
return [];
}

View File

@ -6,7 +6,6 @@ use MailPoet\AdminPages\PageRenderer;
use MailPoet\Config\Installer;
use MailPoet\Config\ServicesChecker;
use MailPoet\Cron\CronTrigger;
use MailPoet\Features\FeaturesController;
use MailPoet\Models\Segment;
use MailPoet\Models\Subscriber;
use MailPoet\Services\Bridge;
@ -39,9 +38,6 @@ class Settings {
/** @var Captcha */
private $captcha;
/** @var FeaturesController */
private $features_controller;
/** @var Installation */
private $installation;
@ -52,8 +48,7 @@ class Settings {
WPFunctions $wp,
ServicesChecker $services_checker,
Installation $installation,
Captcha $captcha,
FeaturesController $features_controller
Captcha $captcha
) {
$this->page_renderer = $page_renderer;
$this->settings = $settings;
@ -62,7 +57,6 @@ class Settings {
$this->services_checker = $services_checker;
$this->installation = $installation;
$this->captcha = $captcha;
$this->features_controller = $features_controller;
}
function render() {
@ -94,9 +88,6 @@ class Settings {
'smtp' => Hosts::getSMTPHosts(),
],
'built_in_captcha_supported' => $this->captcha->isSupported(),
'display_woocommerce_editor' => $this->features_controller->isSupported(
FeaturesController::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER
),
];
$data['is_new_user'] = $this->installation->isNewInstallation();

View File

@ -5,7 +5,6 @@ namespace MailPoet\Config;
use MailPoet\API\JSON\API;
use MailPoet\AutomaticEmails\AutomaticEmails;
use MailPoet\Cron\CronTrigger;
use MailPoet\Features\FeaturesController;
use MailPoet\Router;
use MailPoet\Settings\SettingsController;
use MailPoet\Util\ConflictResolver;
@ -39,9 +38,6 @@ class Initializer {
/** @var SettingsController */
private $settings;
/** @var FeaturesController */
private $flags_controller;
/** @var Router\Router */
private $router;
@ -88,7 +84,6 @@ class Initializer {
PermanentNotices $permanent_notices,
Shortcodes $shortcodes,
DatabaseInitializer $database_initializer,
FeaturesController $flags_controller,
WCTransactionalEmails $wc_transactional_emails,
WooCommerceHelper $wc_helper
) {
@ -105,7 +100,6 @@ class Initializer {
$this->permanent_notices = $permanent_notices;
$this->shortcodes = $shortcodes;
$this->database_initializer = $database_initializer;
$this->flags_controller = $flags_controller;
$this->wc_transactional_emails = $wc_transactional_emails;
$this->wc_helper = $wc_helper;
}
@ -354,10 +348,9 @@ class Initializer {
}
private function setupWoocommerceTransactionalEmails() {
$feature_enabled = $this->flags_controller->isSupported(FeaturesController::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER);
$opt_in_enabled = $this->settings->get('woocommerce.use_mailpoet_editor', false);
$wc_enabled = $this->wc_helper->isWooCommerceActive();
if ($feature_enabled && $wc_enabled) {
$opt_in_enabled = $this->settings->get('woocommerce.use_mailpoet_editor', false);
if ($wc_enabled) {
$this->wc_transactional_emails->enableEmailSettingsSyncToWooCommerce();
if ($opt_in_enabled) {
$this->wc_transactional_emails->useTemplateForWoocommerceEmails();

View File

@ -9,14 +9,12 @@ class FeaturesController {
// Define features below in the following form:
// const FEATURE_NAME_OF_FEATURE = 'name-of-feature';
const NEW_DEFAULT_LIST_NAME = 'new-default-list-name';
const WC_TRANSACTIONAL_EMAILS_CUSTOMIZER = 'wc-transactional-emails-customizer';
const NEW_FORM_EDITOR = 'new-form-editor';
// Define feature defaults in the array below in the following form:
// self::FEATURE_NAME_OF_FEATURE => true,
private $defaults = [
self::NEW_DEFAULT_LIST_NAME => false,
self::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER => false,
self::NEW_FORM_EDITOR => false,
];

View File

@ -3,15 +3,11 @@
namespace MailPoet\WooCommerce;
use MailPoet\Config\Renderer;
use MailPoet\Features\FeaturesController;
use MailPoet\Settings\SettingsController;
use MailPoet\WooCommerce\TransactionalEmails;
class Settings {
/** @var FeaturesController */
private $features_controller;
/** @var Renderer */
private $renderer;
@ -19,11 +15,9 @@ class Settings {
private $settings;
function __construct(
FeaturesController $features_controller,
Renderer $renderer,
SettingsController $settings
) {
$this->features_controller = $features_controller;
$this->renderer = $renderer;
$this->settings = $settings;
}
@ -36,9 +30,6 @@ class Settings {
) {
return;
}
if (!$this->features_controller->isSupported(FeaturesController::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER)) {
return;
}
if (!(bool)$this->settings->get('woocommerce.use_mailpoet_editor')) {
return;
}

View File

@ -2,8 +2,6 @@
namespace MailPoet\Test\Acceptance;
use MailPoet\Features\FeaturesController;
use MailPoet\Test\DataFactories\Features;
use MailPoet\Test\DataFactories\Settings;
class WooCommerceEmailCustomizationCest {
@ -11,9 +9,6 @@ class WooCommerceEmailCustomizationCest {
/** @var Settings */
private $settings;
/** @var Features */
private $features;
/** @var int */
private $woocommerce_email_template_id;
@ -22,15 +17,7 @@ class WooCommerceEmailCustomizationCest {
function _before(\AcceptanceTester $I) {
$I->activateWooCommerce();
$this->features = new Features;
$this->settings = new Settings();
$this->features->withFeatureEnabled(FeaturesController::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER);
// TODO: remove next 4 lines when WC_TRANSACTIONAL_EMAILS_CUSTOMIZER flag is removed
$I->login();
$I->amOnPluginsPage();
$I->deactivatePlugin('mailpoet');
$I->activatePlugin('mailpoet');
$this->wc_customizer_disabled_message = 'The usage of this email template for your WooCommerce emails is not yet activated.';
}

View File

@ -2,8 +2,6 @@
namespace MailPoet\Test\Acceptance;
use MailPoet\Features\FeaturesController;
use MailPoet\Test\DataFactories\Features;
use MailPoet\Test\DataFactories\Settings;
class WooCommerceSettingsTabCest {
@ -11,16 +9,9 @@ class WooCommerceSettingsTabCest {
const CUSTOMIZE_SELECTOR = '[data-automation-id="mailpoet_woocommerce_customize"]';
const DISABLE_SELECTOR = '[data-automation-id="mailpoet_woocommerce_disable"]';
/** @var Features */
private $features;
/** @var Settings */
private $settings_factory;
protected function _inject(Features $features) {
$this->features = $features;
}
function _before(\AcceptanceTester $I) {
$I->activateWooCommerce();
$this->settings_factory = new Settings();
@ -46,7 +37,6 @@ class WooCommerceSettingsTabCest {
}
function checkWooCommercePluginSettingsAreDisabled(\AcceptanceTester $I) {
$this->features->withFeatureEnabled(FeaturesController::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER);
$this->settings_factory->withWooCommerceEmailCustomizerEnabled();
$I->wantTo('Check WooCommerce plugin email settings are overlayed with link to MailPoet');

View File

@ -1,5 +1,4 @@
<table class="form-table">
<% if display_woocommerce_editor %>
<tr>
<th scope="row">
<label for="settings[woocommerce_use_mailpoet_editor]">
@ -28,7 +27,6 @@
>
</td>
</tr>
<% endif %>
<tr>
<th scope="row">
<label for="settings[woocommerce_optin_on_checkout]">