Skip to content

Commit cdf4eed

Browse files
committed
Remove feature switch and make sure we are always checking for us network front
1 parent d7454bd commit cdf4eed

7 files changed

Lines changed: 34 additions & 68 deletions

File tree

app/model/FeatureSwitches.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,10 @@ object PageViewDataVisualisation
2626
enabled = true
2727
)
2828

29-
object HeadlineABTesting
30-
extends FeatureSwitch(
31-
key = "headline-ab-testing",
32-
title = "Enable toggle switch for AB testing headlines",
33-
enabled = false
34-
)
35-
3629
object FeatureSwitches {
3730
val all: List[FeatureSwitch] = List(
3831
ObscureFeed,
39-
PageViewDataVisualisation,
40-
HeadlineABTesting
32+
PageViewDataVisualisation
4133
)
4234

4335
def updateFeatureSwitchesForUser(

fronts-client/src/components/FrontsEdit/CollectionComponents/Collection.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import LoadingGif from 'images/icons/loading.gif';
4545
import OpenFormsWarning from './OpenFormsWarning';
4646
import AbTestHeadlineWarning from './AbTestHeadlineWarning';
4747
import { createSelectActiveAbTestHeadlineErrorsForCollection } from 'selectors/collection';
48-
import { selectFeatureValue } from 'selectors/featureSwitchesSelectors';
4948
import { selectors as editionsIssueSelectors } from '../../../bundles/editionsIssueBundle';
5049
import { moveFrontCollection } from '../../../actions/Editions';
5150

@@ -234,6 +233,8 @@ class Collection extends React.Component<CollectionProps, CollectionState> {
234233

235234
const groupIds = groups.map((group) => group.uuid);
236235

236+
const isUSNetworkFront = frontId === 'us';
237+
237238
return (
238239
<>
239240
<CollectionDisplay
@@ -309,11 +310,13 @@ class Collection extends React.Component<CollectionProps, CollectionState> {
309310
<OpenFormsWarning collectionId={id} frontId={frontId} />
310311
</OpenFormsWarningContainer>
311312
)}
312-
{hasAbTestHeadlineErrors && this.state.showFormWarnings && (
313-
<OpenFormsWarningContainer>
314-
<AbTestHeadlineWarning collectionId={id} />
315-
</OpenFormsWarningContainer>
316-
)}
313+
{hasAbTestHeadlineErrors &&
314+
isUSNetworkFront &&
315+
this.state.showFormWarnings && (
316+
<OpenFormsWarningContainer>
317+
<AbTestHeadlineWarning collectionId={id} />
318+
</OpenFormsWarningContainer>
319+
)}
317320
<EditModeVisibility visibleMode="fronts">
318321
<Button
319322
size="l"
@@ -445,7 +448,6 @@ const createMapStateToProps = () => {
445448
hasContent: !!selectors.selectById(state, collectionId),
446449
hasOpenForms: selectHasOpenForms(state, { collectionId, frontId }),
447450
hasAbTestHeadlineErrors:
448-
selectFeatureValue(state, 'headline-ab-testing') &&
449451
selectActiveAbTestHeadlineErrorsForCollection(state, { collectionId })
450452
.length > 0,
451453
isFeast: editionsIssueSelectors.selectAll(state)?.platform === 'feast',

fronts-client/src/components/FrontsEdit/CollectionOverview.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import EditModeVisibility from 'components/util/EditModeVisibility';
2020
import { createSelectCollectionIdsWithOpenForms } from 'bundles/frontsUI';
2121
import { css } from 'styled-components';
2222
import { ConicalFlaskIcon } from 'components/icons/Icons';
23-
import { selectFeatureValue } from 'selectors/featureSwitchesSelectors';
2423
import { hasActiveAbTestOnCard } from '../../util/abTests';
2524

2625
interface FrontCollectionOverviewContainerProps {
@@ -37,7 +36,6 @@ type FrontCollectionOverviewProps = FrontCollectionOverviewContainerProps & {
3736
hasUnpublishedChanges: boolean;
3837
hasOpenForms: boolean;
3938
liveAndDraftCards: Card[];
40-
headlineABTestingIsEnabled?: boolean;
4139
};
4240

4341
const Container = styled.div<{
@@ -140,9 +138,14 @@ const CollectionOverview = ({
140138
isSelected,
141139
hasOpenForms,
142140
liveAndDraftCards,
143-
headlineABTestingIsEnabled,
144-
}: FrontCollectionOverviewProps) =>
145-
collection ? (
141+
}: FrontCollectionOverviewProps) => {
142+
/*
143+
* Initial rollout of Editorial AB testing will be limited to the US front only.
144+
* Removal of this front restriction will be covered by https://github.com/guardian/frontend/issues/29129
145+
*/
146+
const isUSNetworkFront = frontId === 'us';
147+
148+
return collection ? (
146149
<Container
147150
onClick={(e: React.MouseEvent) => {
148151
e.preventDefault();
@@ -199,7 +202,7 @@ const CollectionOverview = ({
199202
</EditModeVisibility>
200203
) : null)}
201204
{liveAndDraftCards.some(
202-
(card) => hasActiveAbTestOnCard(card) && headlineABTestingIsEnabled,
205+
(card) => hasActiveAbTestOnCard(card) && isUSNetworkFront,
203206
) && (
204207
<EditModeVisibility visibleMode="fronts">
205208
<TestIndicator priority="primary" size="s" title="Active tests">
@@ -210,7 +213,7 @@ const CollectionOverview = ({
210213
</TextContainerRight>
211214
</Container>
212215
) : null;
213-
216+
};
214217
const mapStateToProps = () => {
215218
const selectCollection = createSelectCollection();
216219
const selectCardsInCollection = createSelectCardsInCollection();
@@ -243,10 +246,6 @@ const mapStateToProps = () => {
243246
collectionId,
244247
) !== -1,
245248
liveAndDraftCards: selectLiveAndDraftCards(state, collectionId),
246-
headlineABTestingIsEnabled: selectFeatureValue(
247-
state,
248-
'headline-ab-testing',
249-
),
250249
});
251250
};
252251

fronts-client/src/components/card/article/ArticleBody.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ interface ArticleBodyProps {
247247
};
248248
abTestEnabled?: boolean;
249249
hasLiveAbTest?: boolean;
250-
headlineABTestingIsEnabled?: boolean;
251250
headlineTestError?: AbTestHeadlineErrorType | null;
252251
}
253252

@@ -308,7 +307,6 @@ const articleBodyDefault = React.memo(
308307
intendedAudience,
309308
abTestEnabled,
310309
hasLiveAbTest,
311-
headlineABTestingIsEnabled,
312310
headlineTestError,
313311
}: ArticleBodyProps) => {
314312
const displayByline = size === 'default' && showByline && byline;
@@ -410,6 +408,14 @@ const articleBodyDefault = React.memo(
410408
headlineTestError,
411409
);
412410

411+
/*
412+
* Initial rollout of Editorial AB testing will be limited to the US front only.
413+
* Removal of this front restriction will be covered by https://github.com/guardian/frontend/issues/29129
414+
*/
415+
const isUSNetworkFront = frontId === 'us';
416+
417+
const shouldShowAbTestStatus = !!abTestStatus && isUSNetworkFront;
418+
413419
return (
414420
<>
415421
{showMeta && (
@@ -536,7 +542,7 @@ const articleBodyDefault = React.memo(
536542
)}
537543
{displayByline && <ArticleBodyByline>{byline}</ArticleBodyByline>}
538544
</CardHeadingContainer>
539-
{abTestStatus && headlineABTestingIsEnabled && (
545+
{shouldShowAbTestStatus && (
540546
<ABTestStatus abTestTheme={abTestStatus.theme}>
541547
{abTestStatus.theme === 'error' ? (
542548
<ExclamationIcon fill={abTestStatus.palette.icon} size={'s'} />

fronts-client/src/components/card/article/ArticleCard.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ interface ArticleComponentProps {
7474
groupIndex?: number;
7575
otherCollectionsOnSameFrontThisCardIsOn?: OtherCollectionsOnSameFrontThisCardIsOn;
7676
hasLiveAbTest?: boolean;
77-
headlineABTestingIsEnabled?: boolean;
7877
headlineTestError?: AbTestHeadlineErrorType | null;
7978
}
8079

@@ -128,7 +127,6 @@ class ArticleCard extends React.Component<ComponentProps, ComponentState> {
128127
groupIndex,
129128
otherCollectionsOnSameFrontThisCardIsOn,
130129
hasLiveAbTest,
131-
headlineABTestingIsEnabled,
132130
headlineTestError,
133131
} = this.props;
134132

@@ -204,7 +202,6 @@ class ArticleCard extends React.Component<ComponentProps, ComponentState> {
204202
intendedAudienceFromTags(article.tags)
205203
}
206204
hasLiveAbTest={hasLiveAbTest}
207-
headlineABTestingIsEnabled={headlineABTestingIsEnabled}
208205
headlineTestError={headlineTestError}
209206
/>
210207
</ArticleBodyContainer>
@@ -228,7 +225,6 @@ const createMapStateToProps = () => {
228225
isLoading: boolean;
229226
featureFlagPageViewData: boolean;
230227
hasLiveAbTest?: boolean;
231-
headlineABTestingIsEnabled: boolean;
232228
headlineTestError: AbTestHeadlineErrorType | null;
233229
} => {
234230
const article = selectArticle(state, props.id);
@@ -241,13 +237,7 @@ const createMapStateToProps = () => {
241237
);
242238
const hasLiveAbTest = hasActiveAbTestOnCard(liveCard);
243239
const headlineTestError = getCurrentAbTestHeadlineError(card);
244-
/*
245-
* Initial rollout of Editorial AB testing will be limited to the US front only.
246-
* Removal of this front restriction will be covered by https://github.com/guardian/frontend/issues/29129
247-
*/
248-
const isUSNetworkFront = props.frontId === 'us';
249-
const headlineABTestingIsEnabled =
250-
isUSNetworkFront && selectFeatureValue(state, 'headline-ab-testing');
240+
251241
return {
252242
article,
253243
isLoading: selectors.selectIsLoadingInitialDataById(state, card.id),
@@ -256,7 +246,6 @@ const createMapStateToProps = () => {
256246
'page-view-data-visualisation',
257247
),
258248
hasLiveAbTest: hasLiveAbTest,
259-
headlineABTestingIsEnabled: headlineABTestingIsEnabled,
260249
headlineTestError: headlineTestError,
261250
};
262251
};

fronts-client/src/components/form/__tests__/ArticleMetaForm.spec.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ const variantMeta: VariantMeta[] = [
1515
{ id: 'B', meta: { headline: 'Headline B variant' } },
1616
];
1717

18-
// TODO: Remove when no longer gated behind feature switch
19-
jest.mock('util/extractConfigFromPage', () => {
20-
const baseConfig = jest.requireActual('fixtures/config').default;
21-
return {
22-
__esModule: true,
23-
default: {
24-
...baseConfig,
25-
userData: {
26-
featureSwitches: [{ key: 'headline-ab-testing', enabled: true }],
27-
},
28-
},
29-
};
30-
});
31-
3218
afterEach(cleanup);
3319

3420
const cardId = 'exampleId';

fronts-client/src/components/inputs/HeadlineInput.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import InputCheckboxToggleInline from './InputCheckboxToggleInline';
77
import ConditionalField from './ConditionalField';
88
import { OphanBanner } from '../OphanBanner';
99
import styled from 'styled-components';
10-
import pageConfig from '../../util/extractConfigFromPage';
1110
import { normaliseHeadline } from '../../util/abTests';
1211

1312
interface HeadlineInputProps {
@@ -69,23 +68,16 @@ const HeadlineInput = ({ ...props }: HeadlineInputProps) => {
6968

7069
const getInputId = (cardId: string, label: string) => `${cardId}-${label}`;
7170

72-
const headlineABTestingFeatureSwitch =
73-
pageConfig?.userData?.featureSwitches.find(
74-
(feature) => feature.key === 'headline-ab-testing',
75-
);
76-
7771
/*
7872
* Initial rollout of Editorial AB testing will be limited to the US front only.
7973
* Removal of this front restriction will be covered by https://github.com/guardian/frontend/issues/29129
8074
*/
8175
const isUSNetworkFront = props.frontId === 'us';
82-
const abTestFeatureEnabled =
83-
isUSNetworkFront && headlineABTestingFeatureSwitch?.enabled === true;
8476
return (
8577
<HeadlineInputContainer
86-
abTestEnabled={props.abTestEnabled && abTestFeatureEnabled}
78+
abTestEnabled={props.abTestEnabled && isUSNetworkFront}
8779
>
88-
{props.cardId && abTestFeatureEnabled && (
80+
{props.cardId && isUSNetworkFront && (
8981
<ABTestToggleContainer>
9082
<Field
9183
name="abTestEnabled"
@@ -101,7 +93,7 @@ const HeadlineInput = ({ ...props }: HeadlineInputProps) => {
10193
</ABTestToggleContainer>
10294
)}
10395

104-
{props.abTestEnabled && abTestFeatureEnabled ? (
96+
{props.abTestEnabled && isUSNetworkFront ? (
10597
<HeadlineVariantContainer>
10698
<ConditionalField
10799
permittedFields={props.editableFields}
@@ -136,7 +128,7 @@ const HeadlineInput = ({ ...props }: HeadlineInputProps) => {
136128
data-testid="edit-form-headline-field"
137129
/>
138130
)}
139-
{abTestFeatureEnabled && props.abTestEnabled && props.hasActiveABTest && (
131+
{isUSNetworkFront && props.abTestEnabled && props.hasActiveABTest && (
140132
<OphanBanner />
141133
)}
142134
</HeadlineInputContainer>

0 commit comments

Comments
 (0)