Remove new-default-list-name feature flag [MAILPOET-3004]

This commit is contained in:
wxa
2020-09-08 11:29:50 +03:00
committed by Veljko V
parent f98b8556b3
commit b0e7a486ff
12 changed files with 7 additions and 35 deletions

View File

@ -24,7 +24,7 @@ In MailPoet, subscribers are organized into lists. This method returns an array
[ [
0 => [ 0 => [
'id' => '3', 'id' => '3',
'name' => 'My First List', 'name' => 'Newsletter mailing list',
'type' => 'default', 'type' => 'default',
'description' => 'This list is automatically created when you install MailPoet.', 'description' => 'This list is automatically created when you install MailPoet.',
'created_at' => '2019-05-07 07:24:37', 'created_at' => '2019-05-07 07:24:37',

View File

@ -11,7 +11,6 @@ use MailPoet\Cron\Workers\SubscriberLinkTokens;
use MailPoet\Cron\Workers\UnsubscribeTokens; use MailPoet\Cron\Workers\UnsubscribeTokens;
use MailPoet\Entities\FormEntity; use MailPoet\Entities\FormEntity;
use MailPoet\Entities\UserFlagEntity; use MailPoet\Entities\UserFlagEntity;
use MailPoet\Features\FeaturesController;
use MailPoet\Form\FormFactory; use MailPoet\Form\FormFactory;
use MailPoet\Form\FormsRepository; use MailPoet\Form\FormsRepository;
use MailPoet\Mailer\MailerLog; use MailPoet\Mailer\MailerLog;
@ -49,8 +48,6 @@ class Populator {
/** @var ReferralDetector */ /** @var ReferralDetector */
private $referralDetector; private $referralDetector;
const TEMPLATES_NAMESPACE = '\MailPoet\Config\PopulatorData\Templates\\'; const TEMPLATES_NAMESPACE = '\MailPoet\Config\PopulatorData\Templates\\';
/** @var FeaturesController */
private $flagsController;
/** @var FormFactory */ /** @var FormFactory */
private $formFactory; private $formFactory;
/** @var FormsRepository */ /** @var FormsRepository */
@ -61,7 +58,6 @@ class Populator {
WPFunctions $wp, WPFunctions $wp,
Captcha $captcha, Captcha $captcha,
ReferralDetector $referralDetector, ReferralDetector $referralDetector,
FeaturesController $flagsController,
FormsRepository $formsRepository, FormsRepository $formsRepository,
FormFactory $formFactory FormFactory $formFactory
) { ) {
@ -151,7 +147,6 @@ class Populator {
'Painter', 'Painter',
'FarmersMarket', 'FarmersMarket',
]; ];
$this->flagsController = $flagsController;
$this->formsRepository = $formsRepository; $this->formsRepository = $formsRepository;
} }
@ -349,13 +344,10 @@ class Populator {
if (!$defaultSegment instanceof Segment) { if (!$defaultSegment instanceof Segment) {
$defaultSegment = Segment::create(); $defaultSegment = Segment::create();
$newList = [ $newList = [
'name' => $this->wp->__('My First List', 'mailpoet'), 'name' => $this->wp->__('Newsletter mailing list', 'mailpoet'),
'description' => 'description' =>
$this->wp->__('This list is automatically created when you install MailPoet.', 'mailpoet'), $this->wp->__('This list is automatically created when you install MailPoet.', 'mailpoet'),
]; ];
if ($this->flagsController->isSupported(FeaturesController::NEW_DEFAULT_LIST_NAME)) {
$newList['name'] = $this->wp->__('Newsletter mailing list', 'mailpoet');
}
$defaultSegment->hydrate($newList); $defaultSegment->hydrate($newList);
$defaultSegment->save(); $defaultSegment->save();
} }

View File

@ -8,13 +8,11 @@ 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 TEMPLATES_SELECTION = 'templates-selection'; const TEMPLATES_SELECTION = 'templates-selection';
// 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::TEMPLATES_SELECTION => false, self::TEMPLATES_SELECTION => false,
]; ];

View File

@ -11,7 +11,7 @@ class ManageListsCest {
$i->login(); $i->login();
$i->amOnMailpoetPage('Lists'); $i->amOnMailpoetPage('Lists');
$i->waitForText('WordPress Users', 5, '[data-automation-id="listing_item_1"]'); $i->waitForText('WordPress Users', 5, '[data-automation-id="listing_item_1"]');
$i->see('My First List', '[data-automation-id="listing_item_3"]'); $i->see('Newsletter mailing list', '[data-automation-id="listing_item_3"]');
$i->seeNoJSErrors(); $i->seeNoJSErrors();
} }

View File

@ -50,7 +50,7 @@ class ReinstallFromScratchCest {
// Check lists // Check lists
$i->amOnMailpoetPage('Lists'); $i->amOnMailpoetPage('Lists');
$i->waitForText('WordPress Users', 30, '[data-automation-id="listing_item_1"]'); $i->waitForText('WordPress Users', 30, '[data-automation-id="listing_item_1"]');
$i->see('My First List', '[data-automation-id="listing_item_3"]'); $i->see('Newsletter mailing list', '[data-automation-id="listing_item_3"]');
$i->seeNumberOfElements('[data-automation-id^=listing_item_]', 2); $i->seeNumberOfElements('[data-automation-id^=listing_item_]', 2);
// Check subscribers // Check subscribers
$i->amOnMailPoetPage('Subscribers'); $i->amOnMailPoetPage('Subscribers');

View File

@ -53,7 +53,7 @@ class SettingsPageBasicsCest {
//go to settings and opt-in for comments //go to settings and opt-in for comments
$i->amOnMailPoetPage('Settings'); $i->amOnMailPoetPage('Settings');
$i->checkOption('[data-automation-id="subscribe-on_comment-checkbox"]'); $i->checkOption('[data-automation-id="subscribe-on_comment-checkbox"]');
$i->selectOptionInSelect2('My First List'); $i->selectOptionInSelect2('Newsletter mailing list');
$i->click('[data-automation-id="settings-submit-button"]'); $i->click('[data-automation-id="settings-submit-button"]');
//go to the post and perform commenting + opting //go to the post and perform commenting + opting
$i->amOnPage('/'); $i->amOnPage('/');
@ -71,7 +71,7 @@ class SettingsPageBasicsCest {
$i->waitForText($comment, 10, '.comment-content'); $i->waitForText($comment, 10, '.comment-content');
//check if user is really subscribed to a list //check if user is really subscribed to a list
$i->amOnMailpoetPage('Lists'); $i->amOnMailpoetPage('Lists');
$i->clickItemRowActionByItemName('My First List', 'View Subscribers'); $i->clickItemRowActionByItemName('Newsletter mailing list', 'View Subscribers');
$i->waitForText('Subscribers'); $i->waitForText('Subscribers');
$i->waitForText('test@test.com'); $i->waitForText('test@test.com');
$i->waitForText('Unconfirmed'); $i->waitForText('Unconfirmed');

View File

@ -93,7 +93,7 @@ class SubscriberManageImportExportCest {
$this->pasteSimpleList($i); $this->pasteSimpleList($i);
$i->click('[data-automation-id="import-next-step"]'); $i->click('[data-automation-id="import-next-step"]');
$this->chooseListAndConfirm($i); $this->chooseListAndConfirm($i);
$i->see('3 subscribers added to "My First List".'); $i->see('3 subscribers added to "Newsletter mailing list".');
$i->click('View subscribers'); $i->click('View subscribers');
$i->searchFor('mailpoet1@yopmail.com'); $i->searchFor('mailpoet1@yopmail.com');
$i->waitForText('mailpoet1@yopmail.com'); $i->waitForText('mailpoet1@yopmail.com');

View File

@ -8,7 +8,6 @@ use MailPoet\API\JSON\Response as APIResponse;
use MailPoet\API\JSON\v1\Setup; use MailPoet\API\JSON\v1\Setup;
use MailPoet\Config\Activator; use MailPoet\Config\Activator;
use MailPoet\Config\Populator; use MailPoet\Config\Populator;
use MailPoet\Features\FeaturesController;
use MailPoet\Form\FormFactory; use MailPoet\Form\FormFactory;
use MailPoet\Form\FormsRepository; use MailPoet\Form\FormsRepository;
use MailPoet\Referrals\ReferralDetector; use MailPoet\Referrals\ReferralDetector;
@ -29,8 +28,6 @@ class SetupTest extends \MailPoetTest {
'doAction' => asCallable([WPHooksHelper::class, 'doAction']), 'doAction' => asCallable([WPHooksHelper::class, 'doAction']),
]); ]);
$featuresController = Stub::makeEmpty(FeaturesController::class);
$settings = SettingsController::getInstance(); $settings = SettingsController::getInstance();
$referralDetector = new ReferralDetector($wp, $settings); $referralDetector = new ReferralDetector($wp, $settings);
$populator = new Populator( $populator = new Populator(
@ -38,7 +35,6 @@ class SetupTest extends \MailPoetTest {
$wp, $wp,
new Captcha(), new Captcha(),
$referralDetector, $referralDetector,
$featuresController,
$this->diContainer->get(FormsRepository::class), $this->diContainer->get(FormsRepository::class),
$this->diContainer->get(FormFactory::class) $this->diContainer->get(FormFactory::class)
); );

View File

@ -14,7 +14,6 @@ use MailPoet\Cron\Workers\SendingQueue\Tasks\Newsletter as NewsletterTask;
use MailPoet\Cron\Workers\StatsNotifications\Scheduler as StatsNotificationsScheduler; use MailPoet\Cron\Workers\StatsNotifications\Scheduler as StatsNotificationsScheduler;
use MailPoet\DI\ContainerWrapper; use MailPoet\DI\ContainerWrapper;
use MailPoet\Entities\NewsletterEntity; use MailPoet\Entities\NewsletterEntity;
use MailPoet\Features\FeaturesController;
use MailPoet\Form\FormFactory; use MailPoet\Form\FormFactory;
use MailPoet\Form\FormsRepository; use MailPoet\Form\FormsRepository;
use MailPoet\Logging\LoggerFactory; use MailPoet\Logging\LoggerFactory;
@ -73,13 +72,11 @@ class SendingQueueTest extends \MailPoetTest {
wp_set_current_user($wpUsers[0]->ID); wp_set_current_user($wpUsers[0]->ID);
$this->settings = SettingsController::getInstance(); $this->settings = SettingsController::getInstance();
$referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings); $referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings);
$featuresController = Stub::makeEmpty(FeaturesController::class);
$populator = new Populator( $populator = new Populator(
$this->settings, $this->settings,
WPFunctions::get(), WPFunctions::get(),
new Captcha, new Captcha,
$referralDetector, $referralDetector,
$featuresController,
$this->diContainer->get(FormsRepository::class), $this->diContainer->get(FormsRepository::class),
$this->diContainer->get(FormFactory::class) $this->diContainer->get(FormFactory::class)
); );

View File

@ -6,7 +6,6 @@ use Codeception\Stub;
use Codeception\Stub\Expected; use Codeception\Stub\Expected;
use MailPoet\Config\Populator; use MailPoet\Config\Populator;
use MailPoet\Cron\Workers\SendingQueue\Tasks\Mailer as MailerTask; use MailPoet\Cron\Workers\SendingQueue\Tasks\Mailer as MailerTask;
use MailPoet\Features\FeaturesController;
use MailPoet\Form\FormFactory; use MailPoet\Form\FormFactory;
use MailPoet\Form\FormsRepository; use MailPoet\Form\FormsRepository;
use MailPoet\Mailer\Mailer; use MailPoet\Mailer\Mailer;
@ -31,13 +30,11 @@ class MailerTest extends \MailPoetTest {
wp_set_current_user($wpUsers[0]->ID); wp_set_current_user($wpUsers[0]->ID);
$this->settings = SettingsController::getInstance(); $this->settings = SettingsController::getInstance();
$referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings); $referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings);
$featuresController = Stub::makeEmpty(FeaturesController::class);
$populator = new Populator( $populator = new Populator(
$this->settings, $this->settings,
WPFunctions::get(), WPFunctions::get(),
new Captcha, new Captcha,
$referralDetector, $referralDetector,
$featuresController,
$this->diContainer->get(FormsRepository::class), $this->diContainer->get(FormsRepository::class),
$this->diContainer->get(FormFactory::class) $this->diContainer->get(FormFactory::class)
); );

View File

@ -2,9 +2,7 @@
namespace MailPoet\Test\Newsletter; namespace MailPoet\Test\Newsletter;
use Codeception\Util\Stub;
use MailPoet\Config\Populator; use MailPoet\Config\Populator;
use MailPoet\Features\FeaturesController;
use MailPoet\Form\FormFactory; use MailPoet\Form\FormFactory;
use MailPoet\Form\FormsRepository; use MailPoet\Form\FormsRepository;
use MailPoet\Models\CustomField; use MailPoet\Models\CustomField;
@ -43,13 +41,11 @@ class ShortcodesTest extends \MailPoetTest {
parent::_before(); parent::_before();
$this->settings = SettingsController::getInstance(); $this->settings = SettingsController::getInstance();
$referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings); $referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings);
$featuresController = Stub::makeEmpty(FeaturesController::class);
$populator = new Populator( $populator = new Populator(
$this->settings, $this->settings,
WPFunctions::get(), WPFunctions::get(),
new Captcha, new Captcha,
$referralDetector, $referralDetector,
$featuresController,
$this->diContainer->get(FormsRepository::class), $this->diContainer->get(FormsRepository::class),
$this->diContainer->get(FormFactory::class) $this->diContainer->get(FormFactory::class)
); );

View File

@ -2,9 +2,7 @@
namespace MailPoet\Test\Subscription; namespace MailPoet\Test\Subscription;
use Codeception\Util\Stub;
use MailPoet\Config\Populator; use MailPoet\Config\Populator;
use MailPoet\Features\FeaturesController;
use MailPoet\Form\FormFactory; use MailPoet\Form\FormFactory;
use MailPoet\Form\FormsRepository; use MailPoet\Form\FormsRepository;
use MailPoet\Models\Subscriber; use MailPoet\Models\Subscriber;
@ -29,13 +27,11 @@ class UrlTest extends \MailPoetTest {
parent::_before(); parent::_before();
$this->settings = SettingsController::getInstance(); $this->settings = SettingsController::getInstance();
$referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings); $referralDetector = new ReferralDetector(WPFunctions::get(), $this->settings);
$featuresController = Stub::makeEmpty(FeaturesController::class);
$populator = new Populator( $populator = new Populator(
$this->settings, $this->settings,
WPFunctions::get(), WPFunctions::get(),
new Captcha, new Captcha,
$referralDetector, $referralDetector,
$featuresController,
$this->diContainer->get(FormsRepository::class), $this->diContainer->get(FormsRepository::class),
$this->diContainer->get(FormFactory::class) $this->diContainer->get(FormFactory::class)
); );