Skip to content

Commit

Permalink
Merge pull request #538 from guardian/tf-remove-banner-display-rules
Browse files Browse the repository at this point in the history
remove minArticlesBeforeShowingBanner
  • Loading branch information
tomrf1 authored Dec 12, 2023
2 parents b0b1f88 + ecdecb4 commit 479af2d
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 117 deletions.
1 change: 0 additions & 1 deletion app/models/BannerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ case class BannerTest(
lockStatus: Option[LockStatus],
priority: Option[Int],
nickname: Option[String],
minArticlesBeforeShowingBanner: Int,
userCohort: UserCohort,
locations: List[Region] = Nil,
contextTargeting: PageContextTargeting = PageContextTargeting(Nil,Nil,Nil,Nil),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Typography } from '@material-ui/core';
import BannerTestVariantEditor from './bannerTestVariantEditor';
import CampaignSelector from '../CampaignSelector';
import TestVariantsEditor from '../testVariantsEditor';
import TestEditorMinArticlesViewedInput from '../testEditorMinArticlesViewedInput';
import TestEditorTargetAudienceSelector from '../testEditorTargetAudienceSelector';
import TestEditorArticleCountEditor, {
DEFAULT_ARTICLES_VIEWED_SETTINGS,
Expand Down Expand Up @@ -87,9 +86,6 @@ const BannerTestEditor: React.FC<ValidatedTestEditorProps<BannerTest>> = ({
});
};

const onMinArticlesViewedValidationChanged = (isValid: boolean): void =>
setValidationStatusForField('minArticlesViewed', isValid);

const onArticlesViewedSettingsValidationChanged = (isValid: boolean): void =>
setValidationStatusForField('articlesViewedSettings', isValid);

Expand All @@ -116,13 +112,6 @@ const BannerTestEditor: React.FC<ValidatedTestEditorProps<BannerTest>> = ({
onVariantsChange(test.variants.filter(variant => variant.name !== deletedVariantName));
};

const onMinArticlesViewedChange = (updatedMinArticles: number): void => {
updateTest({
...test,
minArticlesBeforeShowingBanner: updatedMinArticles,
});
};

const onRegionsChange = (updatedRegions: Region[]): void => {
updateTest({ ...test, locations: updatedRegions });
};
Expand Down Expand Up @@ -245,19 +234,6 @@ const BannerTestEditor: React.FC<ValidatedTestEditorProps<BannerTest>> = ({
</div>
</div>

<div className={classes.sectionContainer}>
<Typography variant={'h3'} className={classes.sectionHeader}>
Display rules
</Typography>

<TestEditorMinArticlesViewedInput
minArticles={test.minArticlesBeforeShowingBanner}
isDisabled={!userHasTestLocked}
onValidationChange={onMinArticlesViewedValidationChanged}
onUpdate={onMinArticlesViewedChange}
/>
</div>

<div className={classes.sectionContainer}>
<Typography variant={'h3'} className={classes.sectionHeader}>
Target context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@ import { BannerTest } from '../../../models/banner';
import BannerTestEditor from './bannerTestEditor';
import { ValidatedTestEditor } from '../validatedTestEditor';

const createDefaultBannerTest = (minArticles: number) => (
newTestName: string,
newTestNickname: string,
): BannerTest => ({
const createDefaultBannerTest = (newTestName: string, newTestNickname: string): BannerTest => ({
...getDefaultTest(),
name: newTestName,
nickname: newTestNickname,
minArticlesBeforeShowingBanner: minArticles,
});

export const BannerTestsForm1 = TestsForm(
ValidatedTestEditor(BannerTestEditor),
FrontendSettingsType.bannerTests,
createDefaultBannerTest(2),
createDefaultBannerTest,
);

export const BannerTestsForm2 = TestsForm(
ValidatedTestEditor(BannerTestEditor),
FrontendSettingsType.bannerTests2,
createDefaultBannerTest(4),
createDefaultBannerTest,
);
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const DEV_AND_CODE_DEFAULT_BANNER_TEST: BannerTest = {
name: 'TEST',
nickname: 'TEST',
status: 'Draft',
minArticlesBeforeShowingBanner: 0,
userCohort: UserCohort.AllNonSupporters,
locations: [],
variants: [DEV_AND_CODE_DEFAULT_VARIANT],
Expand All @@ -62,7 +61,6 @@ const PROD_DEFAULT_BANNER: BannerTest = {
name: '',
nickname: '',
status: 'Draft',
minArticlesBeforeShowingBanner: 0,
userCohort: UserCohort.AllNonSupporters,
locations: [],
variants: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ const testFields = {
exclude: ['Header', 'Banner1', 'Banner2'],
optional: true,
},
minArticlesBeforeShowingBanner: {
label: 'Min articles before showing banner',
type: 'number',
exclude: ['Header', 'Epic', 'EpicLiveblog', 'EpicAppleNews', 'EpicAMP'],
optional: false,
},
sections: {
label: 'Target sections',
type: 'string-array',
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion public/src/models/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export interface BannerTest extends Test {
name: string;
nickname?: string;
status: Status;
minArticlesBeforeShowingBanner: number;
userCohort: UserCohort;
locations: Region[];
variants: BannerVariant[];
Expand Down

0 comments on commit 479af2d

Please sign in to comment.