Remove the feature flag from Landing page
MAILPOET-4803
This commit is contained in:
committed by
Aschepikov
parent
9ac18ab69e
commit
4be7f37bbc
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
use MailPoet\Features\FeaturesController;
|
|
||||||
use MailPoet\Settings\SettingsController;
|
use MailPoet\Settings\SettingsController;
|
||||||
use MailPoet\Settings\TrackingConfig;
|
use MailPoet\Settings\TrackingConfig;
|
||||||
use MailPoet\Util\Url;
|
use MailPoet\Util\Url;
|
||||||
@@ -25,23 +24,18 @@ class Changelog {
|
|||||||
/** @var TrackingConfig */
|
/** @var TrackingConfig */
|
||||||
private $trackingConfig;
|
private $trackingConfig;
|
||||||
|
|
||||||
/** @var FeaturesController */
|
|
||||||
private $featuresController;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SettingsController $settings,
|
SettingsController $settings,
|
||||||
WPFunctions $wp,
|
WPFunctions $wp,
|
||||||
Helper $wooCommerceHelper,
|
Helper $wooCommerceHelper,
|
||||||
Url $urlHelper,
|
Url $urlHelper,
|
||||||
TrackingConfig $trackingConfig,
|
TrackingConfig $trackingConfig
|
||||||
FeaturesController $featuresController
|
|
||||||
) {
|
) {
|
||||||
$this->wooCommerceHelper = $wooCommerceHelper;
|
$this->wooCommerceHelper = $wooCommerceHelper;
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
$this->wp = $wp;
|
$this->wp = $wp;
|
||||||
$this->urlHelper = $urlHelper;
|
$this->urlHelper = $urlHelper;
|
||||||
$this->trackingConfig = $trackingConfig;
|
$this->trackingConfig = $trackingConfig;
|
||||||
$this->featuresController = $featuresController;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
@@ -88,7 +82,7 @@ class Changelog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function shouldShowLandingPage(): bool {
|
public function shouldShowLandingPage(): bool {
|
||||||
return $this->shouldShowWelcomeWizard() && $this->featuresController->isSupported(FeaturesController::FEATURE_LANDINGPAGE);
|
return $this->shouldShowWelcomeWizard();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldShowWooCommerceListImportPage() {
|
public function shouldShowWooCommerceListImportPage() {
|
||||||
@@ -121,28 +115,13 @@ class Changelog {
|
|||||||
public function maybeRedirectToLandingPage() {
|
public function maybeRedirectToLandingPage() {
|
||||||
if ($this->isWelcomeWizardPage()) return; // do not redirect when on welcome wizard page
|
if ($this->isWelcomeWizardPage()) return; // do not redirect when on welcome wizard page
|
||||||
|
|
||||||
if ($this->shouldShowLandingPage()) {
|
|
||||||
$this->redirectToLandingPage();
|
$this->redirectToLandingPage();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->maybeRedirectToWelcomeWizard(); //TODO: Remove when landing page is out of experimental
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setupNewInstallation() {
|
private function setupNewInstallation() {
|
||||||
$this->settings->set('show_congratulate_after_first_newsletter', true);
|
$this->settings->set('show_congratulate_after_first_newsletter', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function maybeRedirectToWelcomeWizard() {
|
|
||||||
if ($this->shouldShowWelcomeWizard() && !$this->isWelcomeWizardPage()) {
|
|
||||||
if ($this->isLandingPage()) return; // do not redirect when on landing page
|
|
||||||
|
|
||||||
$this->urlHelper->redirectWithReferer(
|
|
||||||
$this->wp->adminUrl('admin.php?page=mailpoet-welcome-wizard')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isWelcomeWizardPage() {
|
private function isWelcomeWizardPage() {
|
||||||
return isset($_GET['page']) && sanitize_text_field(wp_unslash($_GET['page'])) === Menu::WELCOME_WIZARD_PAGE_SLUG;
|
return isset($_GET['page']) && sanitize_text_field(wp_unslash($_GET['page'])) === Menu::WELCOME_WIZARD_PAGE_SLUG;
|
||||||
}
|
}
|
||||||
|
@@ -206,7 +206,6 @@ class Menu {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Landingpage
|
// Landingpage
|
||||||
if ($this->featuresController->isSupported(FeaturesController::FEATURE_LANDINGPAGE)) {
|
|
||||||
$this->wp->addSubmenuPage(
|
$this->wp->addSubmenuPage(
|
||||||
true,
|
true,
|
||||||
$this->setPageTitle(__('MailPoet', 'mailpoet')),
|
$this->setPageTitle(__('MailPoet', 'mailpoet')),
|
||||||
@@ -218,7 +217,6 @@ class Menu {
|
|||||||
'landingPage',
|
'landingPage',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// Hide sub-menu entries if the user still needs to complete the Welcome Wizard
|
// Hide sub-menu entries if the user still needs to complete the Welcome Wizard
|
||||||
if (!$this->changelog->shouldShowWelcomeWizard()) {
|
if (!$this->changelog->shouldShowWelcomeWizard()) {
|
||||||
|
@@ -7,15 +7,12 @@ use MailPoetVendor\Doctrine\DBAL\Exception\TableNotFoundException;
|
|||||||
class FeaturesController {
|
class FeaturesController {
|
||||||
const FEATURE_HOMEPAGE = 'homepage';
|
const FEATURE_HOMEPAGE = 'homepage';
|
||||||
|
|
||||||
const FEATURE_LANDINGPAGE = 'landingpage';
|
|
||||||
|
|
||||||
const FEATURE_COUPON_BLOCK = 'Coupon block';
|
const FEATURE_COUPON_BLOCK = 'Coupon block';
|
||||||
|
|
||||||
// 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::FEATURE_HOMEPAGE => false,
|
self::FEATURE_HOMEPAGE => false,
|
||||||
self::FEATURE_LANDINGPAGE => false,
|
|
||||||
self::FEATURE_COUPON_BLOCK => false,
|
self::FEATURE_COUPON_BLOCK => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -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 LandingpageBasicsCest {
|
class LandingpageBasicsCest {
|
||||||
@@ -12,7 +10,6 @@ class LandingpageBasicsCest {
|
|||||||
$i->login();
|
$i->login();
|
||||||
|
|
||||||
// show welcome wizard & landing page
|
// show welcome wizard & landing page
|
||||||
(new Features())->withFeatureEnabled(FeaturesController::FEATURE_LANDINGPAGE);
|
|
||||||
$settings = new Settings();
|
$settings = new Settings();
|
||||||
$settings->withWelcomeWizard();
|
$settings->withWelcomeWizard();
|
||||||
|
|
||||||
@@ -21,7 +18,7 @@ class LandingpageBasicsCest {
|
|||||||
$i->waitForText('Better email — without leaving WordPress');
|
$i->waitForText('Better email — without leaving WordPress');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function homepageRendersAfterActivation(\AcceptanceTester $i) {
|
public function landingpageRendersAfterActivation(\AcceptanceTester $i) {
|
||||||
$i->wantTo('Check landingpage renders after plugin activation for new users');
|
$i->wantTo('Check landingpage renders after plugin activation for new users');
|
||||||
$i->login();
|
$i->login();
|
||||||
|
|
||||||
@@ -29,7 +26,6 @@ class LandingpageBasicsCest {
|
|||||||
$i->waitForText('Create and send newsletters, post notifications and welcome emails from your WordPress.');
|
$i->waitForText('Create and send newsletters, post notifications and welcome emails from your WordPress.');
|
||||||
|
|
||||||
// show welcome wizard & landing page
|
// show welcome wizard & landing page
|
||||||
(new Features())->withFeatureEnabled(FeaturesController::FEATURE_LANDINGPAGE);
|
|
||||||
$settings = new Settings();
|
$settings = new Settings();
|
||||||
$settings->withWelcomeWizard();
|
$settings->withWelcomeWizard();
|
||||||
|
|
||||||
@@ -38,4 +34,19 @@ class LandingpageBasicsCest {
|
|||||||
$i->click('#activate-mailpoet');
|
$i->click('#activate-mailpoet');
|
||||||
$i->waitForText('Better email — without leaving WordPress');
|
$i->waitForText('Better email — without leaving WordPress');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function landingpageRedirectsToWelcomeWizard(\AcceptanceTester $i) {
|
||||||
|
$i->wantTo('Check landingpage redirect to welcome wizard when button is clicked');
|
||||||
|
$i->login();
|
||||||
|
|
||||||
|
// show welcome wizard & landing page
|
||||||
|
$settings = new Settings();
|
||||||
|
$settings->withWelcomeWizard();
|
||||||
|
|
||||||
|
$i->amOnMailpoetPage('Emails');
|
||||||
|
$i->waitForText('Better email — without leaving WordPress');
|
||||||
|
$i->click('Begin setup');
|
||||||
|
|
||||||
|
$i->waitForText('Start by configuring your sender information');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ class ReinstallFromScratchCest {
|
|||||||
$i->waitForElement('[data-automation-id="reinstall-button"]');
|
$i->waitForElement('[data-automation-id="reinstall-button"]');
|
||||||
$i->click('Reinstall now...');
|
$i->click('Reinstall now...');
|
||||||
$i->acceptPopup();
|
$i->acceptPopup();
|
||||||
$i->waitForText('Start by configuring your sender information'); //TODO: Update when landing page is out of experimental
|
$i->waitForText('Better email — without leaving WordPress');
|
||||||
|
|
||||||
// Step 3 - skip all tutorials, which could interfere with other tests
|
// Step 3 - skip all tutorials, which could interfere with other tests
|
||||||
$settings = new Settings();
|
$settings = new Settings();
|
||||||
|
Reference in New Issue
Block a user