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 = () => { getAdditionalTypes = () => {
const show = window.mailpoet_woocommerce_active && MailPoet.FeaturesController.isSupported('wc-transactional-emails-customizer'); const show = window.mailpoet_woocommerce_active;
if (!show) { if (!show) {
return []; return [];
} }

View File

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

View File

@ -5,7 +5,6 @@ namespace MailPoet\Config;
use MailPoet\API\JSON\API; use MailPoet\API\JSON\API;
use MailPoet\AutomaticEmails\AutomaticEmails; use MailPoet\AutomaticEmails\AutomaticEmails;
use MailPoet\Cron\CronTrigger; use MailPoet\Cron\CronTrigger;
use MailPoet\Features\FeaturesController;
use MailPoet\Router; use MailPoet\Router;
use MailPoet\Settings\SettingsController; use MailPoet\Settings\SettingsController;
use MailPoet\Util\ConflictResolver; use MailPoet\Util\ConflictResolver;
@ -39,9 +38,6 @@ class Initializer {
/** @var SettingsController */ /** @var SettingsController */
private $settings; private $settings;
/** @var FeaturesController */
private $flags_controller;
/** @var Router\Router */ /** @var Router\Router */
private $router; private $router;
@ -88,7 +84,6 @@ class Initializer {
PermanentNotices $permanent_notices, PermanentNotices $permanent_notices,
Shortcodes $shortcodes, Shortcodes $shortcodes,
DatabaseInitializer $database_initializer, DatabaseInitializer $database_initializer,
FeaturesController $flags_controller,
WCTransactionalEmails $wc_transactional_emails, WCTransactionalEmails $wc_transactional_emails,
WooCommerceHelper $wc_helper WooCommerceHelper $wc_helper
) { ) {
@ -105,7 +100,6 @@ class Initializer {
$this->permanent_notices = $permanent_notices; $this->permanent_notices = $permanent_notices;
$this->shortcodes = $shortcodes; $this->shortcodes = $shortcodes;
$this->database_initializer = $database_initializer; $this->database_initializer = $database_initializer;
$this->flags_controller = $flags_controller;
$this->wc_transactional_emails = $wc_transactional_emails; $this->wc_transactional_emails = $wc_transactional_emails;
$this->wc_helper = $wc_helper; $this->wc_helper = $wc_helper;
} }
@ -354,10 +348,9 @@ class Initializer {
} }
private function setupWoocommerceTransactionalEmails() { 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(); $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(); $this->wc_transactional_emails->enableEmailSettingsSyncToWooCommerce();
if ($opt_in_enabled) { if ($opt_in_enabled) {
$this->wc_transactional_emails->useTemplateForWoocommerceEmails(); $this->wc_transactional_emails->useTemplateForWoocommerceEmails();

View File

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

View File

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

View File

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

View File

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