Hide inactive subscribers notice behind a feture flag
[MAILPOET-2088]
This commit is contained in:
@ -10,12 +10,14 @@ class FeaturesController {
|
|||||||
// const FEATURE_NAME_OF_FEATURE = 'name-of-feature';
|
// const FEATURE_NAME_OF_FEATURE = 'name-of-feature';
|
||||||
const FEATURE_DISPLAY_WOOCOMMERCE_REVENUES = 'display-woocommerce-revenues'; // may also have 'display_revenues' setting
|
const FEATURE_DISPLAY_WOOCOMMERCE_REVENUES = 'display-woocommerce-revenues'; // may also have 'display_revenues' setting
|
||||||
const FEATURE_ABANDONED_SHOPPING_CART = 'abandoned-shopping-cart';
|
const FEATURE_ABANDONED_SHOPPING_CART = 'abandoned-shopping-cart';
|
||||||
|
const FEATURE_INACTIVE_SUBSCRIBERS_NOTICE = 'inactive-subscribers-notice';
|
||||||
|
|
||||||
// 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_DISPLAY_WOOCOMMERCE_REVENUES => false,
|
self::FEATURE_DISPLAY_WOOCOMMERCE_REVENUES => false,
|
||||||
self::FEATURE_ABANDONED_SHOPPING_CART => false,
|
self::FEATURE_ABANDONED_SHOPPING_CART => false,
|
||||||
|
self::FEATURE_INACTIVE_SUBSCRIBERS_NOTICE => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace MailPoet\Util\Notices;
|
namespace MailPoet\Util\Notices;
|
||||||
|
|
||||||
use MailPoet\Config\Menu;
|
use MailPoet\Config\Menu;
|
||||||
|
use MailPoet\Features\FeaturesController;
|
||||||
use MailPoet\Settings\SettingsController;
|
use MailPoet\Settings\SettingsController;
|
||||||
use MailPoet\WP\Functions as WPFunctions;
|
use MailPoet\WP\Functions as WPFunctions;
|
||||||
|
|
||||||
@ -29,7 +30,10 @@ class PermanentNotices {
|
|||||||
/** @var InactiveSubscribersNotice */
|
/** @var InactiveSubscribersNotice */
|
||||||
private $inactive_subscribers_notice;
|
private $inactive_subscribers_notice;
|
||||||
|
|
||||||
public function __construct(WPFunctions $wp) {
|
/** @var FeaturesController */
|
||||||
|
private $features_controller;
|
||||||
|
|
||||||
|
public function __construct(WPFunctions $wp, FeaturesController $features_controller) {
|
||||||
$this->wp = $wp;
|
$this->wp = $wp;
|
||||||
$this->php_version_warnings = new PHPVersionWarnings();
|
$this->php_version_warnings = new PHPVersionWarnings();
|
||||||
$this->after_migration_notice = new AfterMigrationNotice();
|
$this->after_migration_notice = new AfterMigrationNotice();
|
||||||
@ -37,6 +41,7 @@ class PermanentNotices {
|
|||||||
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $wp);
|
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $wp);
|
||||||
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $wp);
|
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $wp);
|
||||||
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $wp);
|
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $wp);
|
||||||
|
$this->features_controller = $features_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
@ -59,7 +64,8 @@ class PermanentNotices {
|
|||||||
Menu::isOnMailPoetAdminPage($exclude = null, $page_id = 'mailpoet-newsletters')
|
Menu::isOnMailPoetAdminPage($exclude = null, $page_id = 'mailpoet-newsletters')
|
||||||
);
|
);
|
||||||
$this->inactive_subscribers_notice->init(
|
$this->inactive_subscribers_notice->init(
|
||||||
Menu::isOnMailPoetAdminPage($exclude = ['mailpoet-welcome-wizard'])
|
$this->features_controller->isSupported(FeaturesController::FEATURE_INACTIVE_SUBSCRIBERS_NOTICE)
|
||||||
|
&& Menu::isOnMailPoetAdminPage($exclude = ['mailpoet-welcome-wizard'])
|
||||||
);
|
);
|
||||||
$this->discounts_announcement->init(
|
$this->discounts_announcement->init(
|
||||||
empty($_GET['page'])
|
empty($_GET['page'])
|
||||||
|
Reference in New Issue
Block a user