Remove re-engagement-email feature flag

[MAILPOET-3859]
This commit is contained in:
Rodrigo Primo
2021-11-17 15:03:37 -03:00
committed by Veljko V
parent 28061a8c8b
commit 84209851e2
7 changed files with 18 additions and 51 deletions

View File

@@ -42,7 +42,6 @@ const trackTabSwitch = (tabKey) => MailPoet.trackEvent(`Tab Emails > ${tabKey} c
const Tabs = withNpsPoll(() => { const Tabs = withNpsPoll(() => {
const { parentId } = useParams(); const { parentId } = useParams();
const { features } = React.useContext(GlobalContext);
return ( return (
<> <>
<ListingHeadingDisplay> <ListingHeadingDisplay>
@@ -83,16 +82,14 @@ const Tabs = withNpsPoll(() => {
: <NewsletterListNotification /> : <NewsletterListNotification />
} }
</Tab> </Tab>
{(features.isSupported('re-engagement-email')) && ( <Tab
<Tab key="re_engagement"
key="re_engagement" route="re_engagement/(.*)?"
route="re_engagement/(.*)?" title={MailPoet.I18n.t('tabReEngagementTitle')}
title={MailPoet.I18n.t('tabReEngagementTitle')} automationId={`tab-${MailPoet.I18n.t('tabReEngagementTitle')}`}
automationId={`tab-${MailPoet.I18n.t('tabReEngagementTitle')}`} >
> <NewsletterListReEngagement />
<NewsletterListReEngagement /> </Tab>
</Tab>
)}
{window.mailpoet_woocommerce_active && _.map(automaticEmails, (email) => ( {window.mailpoet_woocommerce_active && _.map(automaticEmails, (email) => (
<Tab <Tab
key={email.slug} key={email.slug}

View File

@@ -34,6 +34,10 @@ templatesCategories.push(
name: 'notification', name: 'notification',
label: MailPoet.I18n.t('tabNotificationTitle'), label: MailPoet.I18n.t('tabNotificationTitle'),
}, },
{
name: 're_engagement',
label: MailPoet.I18n.t('tabReEngagementTitle'),
},
{ {
name: 'blank', name: 'blank',
label: MailPoet.I18n.t('tabBlankTitle'), label: MailPoet.I18n.t('tabBlankTitle'),
@@ -75,8 +79,6 @@ class NewsletterTemplates extends React.Component {
} }
componentDidMount() { componentDidMount() {
this.addReEngagementCategory();
MailPoet.Ajax.get({ MailPoet.Ajax.get({
api_version: window.mailpoet_api_version, api_version: window.mailpoet_api_version,
endpoint: 'newsletterTemplates', endpoint: 'newsletterTemplates',
@@ -106,21 +108,6 @@ class NewsletterTemplates extends React.Component {
}); });
} }
// We want temporarily to allow re-engagement emails only when the feature is active
addReEngagementCategory() {
if (this.context.features.isSupported('re-engagement-email')) {
const notificationIndex = templatesCategories.map((category) => category.name).indexOf('notification');
const categoriesTmp = templatesCategories.splice(notificationIndex + 1);
templatesCategories.push(
{
name: 're_engagement',
label: MailPoet.I18n.t('tabReEngagementTitle'),
},
...categoriesTmp
);
}
}
addTemplate(template) { addTemplate(template) {
const categoriesNames = templatesCategories.map((category) => category.name); const categoriesNames = templatesCategories.map((category) => category.name);
let categories; let categories;

View File

@@ -11,7 +11,6 @@ import Heading from 'common/typography/heading/heading';
import ModalCloseIcon from 'common/modal/close_icon'; import ModalCloseIcon from 'common/modal/close_icon';
import HideScreenOptions from 'common/hide_screen_options/hide_screen_options'; import HideScreenOptions from 'common/hide_screen_options/hide_screen_options';
import APIErrorsNotice from '../notices/api_errors_notice'; import APIErrorsNotice from '../notices/api_errors_notice';
import { GlobalContext } from '../context';
interface Props { interface Props {
filter?: () => void; filter?: () => void;
@@ -36,9 +35,6 @@ const NewsletterTypes: React.FunctionComponent<Props> = ({
hideScreenOptions = true, hideScreenOptions = true,
}: Props) => { }: Props) => {
const [isCreating, setIsCreating] = useState(false); const [isCreating, setIsCreating] = useState(false);
// this is here temporarily and the global context isn't in typescript yet
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { features } = React.useContext<any>(GlobalContext);
const setupNewsletter = (type): void => { const setupNewsletter = (type): void => {
if (type !== undefined) { if (type !== undefined) {
@@ -267,9 +263,7 @@ const NewsletterTypes: React.FunctionComponent<Props> = ({
</Button> </Button>
), ),
}, },
]; {
if (features.isSupported('re-engagement-email')) {
defaultTypes.push({
slug: 're_engagement', slug: 're_engagement',
title: MailPoet.I18n.t('tabReEngagementTitle'), title: MailPoet.I18n.t('tabReEngagementTitle'),
description: MailPoet.I18n.t('reEngagementDescription'), description: MailPoet.I18n.t('reEngagementDescription'),
@@ -290,8 +284,8 @@ const NewsletterTypes: React.FunctionComponent<Props> = ({
{MailPoet.I18n.t('setUp')} {MailPoet.I18n.t('setUp')}
</Button> </Button>
), ),
}); },
} ];
let types = Hooks.applyFilters('mailpoet_newsletters_types', [ let types = Hooks.applyFilters('mailpoet_newsletters_types', [
...defaultTypes, ...defaultTypes,

View File

@@ -4,12 +4,9 @@ import { t } from 'common/functions';
import Radio from 'common/form/radio/radio'; import Radio from 'common/form/radio/radio';
import { useSetting } from 'settings/store/hooks'; import { useSetting } from 'settings/store/hooks';
import { Label, Inputs } from 'settings/components'; import { Label, Inputs } from 'settings/components';
import { GlobalContext } from 'context/index.jsx';
export default function Tracking() { export default function Tracking() {
const [enabled, setEnabled] = useSetting('tracking', 'enabled'); const [enabled, setEnabled] = useSetting('tracking', 'enabled');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { features } = React.useContext<any>(GlobalContext);
return ( return (
<> <>
@@ -39,7 +36,7 @@ export default function Tracking() {
/> />
<label htmlFor="tracking-disabled"> <label htmlFor="tracking-disabled">
{t('no')} {t('no')}
{features.isSupported('re-engagement-email') && !enabled && ( {!enabled && (
<> <>
<br /> <br />
<span className="mailpoet-note"> <span className="mailpoet-note">

View File

@@ -83,9 +83,7 @@ class Daemon {
yield $this->workersFactory->createSubscribersEngagementScoreWorker(); yield $this->workersFactory->createSubscribersEngagementScoreWorker();
yield $this->workersFactory->createSubscribersLastEngagementWorker(); yield $this->workersFactory->createSubscribersLastEngagementWorker();
yield $this->workersFactory->createSubscribersCountCacheRecalculationWorker(); yield $this->workersFactory->createSubscribersCountCacheRecalculationWorker();
if ($this->featureSwitch->isSupported(FeaturesController::RE_ENGAGEMENT_EMAIL)) { yield $this->workersFactory->createReEngagementEmailsSchedulerWorker();
yield $this->workersFactory->createReEngagementEmailsSchedulerWorker();
}
yield $this->workersFactory->createNewsletterTemplateThumbnailsWorker(); yield $this->workersFactory->createNewsletterTemplateThumbnailsWorker();
} }
} }

View File

@@ -5,13 +5,10 @@ namespace MailPoet\Features;
use MailPoetVendor\Doctrine\DBAL\Exception\TableNotFoundException; use MailPoetVendor\Doctrine\DBAL\Exception\TableNotFoundException;
class FeaturesController { class FeaturesController {
const RE_ENGAGEMENT_EMAIL = 're-engagement-email';
// 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::RE_ENGAGEMENT_EMAIL => false,
];
/** @var array */ /** @var array */
private $flags; private $flags;

View File

@@ -3,7 +3,6 @@
namespace MailPoet\Test\Acceptance; namespace MailPoet\Test\Acceptance;
use Codeception\Util\Locator; use Codeception\Util\Locator;
use MailPoet\Test\DataFactories\Features;
class AdvancedSettingsCest { class AdvancedSettingsCest {
public function toggleAnonymousDataSetting(\AcceptanceTester $i) { public function toggleAnonymousDataSetting(\AcceptanceTester $i) {
@@ -135,8 +134,6 @@ class AdvancedSettingsCest {
} }
public function checkInactiveSubscribersAndEmails(\AcceptanceTester $i) { public function checkInactiveSubscribersAndEmails(\AcceptanceTester $i) {
$features = new Features();
$features->withFeatureEnabled('re-engagement-email');
$i->wantTo('Check that inactive subscribers has default value'); $i->wantTo('Check that inactive subscribers has default value');
$inactiveSubscribersDefault = '[data-automation-id="inactive-subscribers-default"]'; $inactiveSubscribersDefault = '[data-automation-id="inactive-subscribers-default"]';
$trackingEnabled = '[data-automation-id="tracking-enabled-radio"]'; $trackingEnabled = '[data-automation-id="tracking-enabled-radio"]';