From fdb0eb82c0401c08b61be2babeddd546b6b3dda1 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:07:44 +0100 Subject: [PATCH 1/7] Bump facia-scala-client and add suppressImages prop to frontsToolSettings type --- build.sbt | 6 +-- fronts-client/src/types/FaciaApi.ts | 1 + test/fixtures/FakeCapiAndOphan.scala | 2 +- .../editions/EditionsTemplatingTest.scala | 2 +- test/util/ContentUpgradeTest.scala | 48 ++++++++++++++----- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/build.sbt b/build.sbt index 8c348c57fb3..564927c8bce 100644 --- a/build.sbt +++ b/build.sbt @@ -44,8 +44,8 @@ TwirlKeys.templateImports ++= Seq( routesImport += "model.editions._" val awsVersion = "1.12.470" -val capiModelsVersion = "23.0.0" -val capiClientVersion = "26.0.0" +val capiModelsVersion = "25.0.0" +val capiClientVersion = "32.0.0" val json4sVersion = "4.0.3" val circeVersion = "0.13.0" @@ -74,7 +74,7 @@ libraryDependencies ++= Seq( "com.gu" %% "content-api-client-aws" % "0.6", "com.gu" %% "content-api-client-default" % capiClientVersion, "com.gu" %% "editorial-permissions-client" % "3.0.0", - "com.gu" %% "fapi-client-play30" % "6.0.0", + "com.gu" %% "fapi-client-play30" % "11.0.0-PREVIEW.gladd-suppress-images-property.2024-09-26T1303.d2af9509", "com.gu" %% "mobile-notifications-api-models" % "3.0.0", "com.gu" %% "pan-domain-auth-play_3-0" % "4.0.0", diff --git a/fronts-client/src/types/FaciaApi.ts b/fronts-client/src/types/FaciaApi.ts index f6f41a9e4bf..53788edc432 100644 --- a/fronts-client/src/types/FaciaApi.ts +++ b/fronts-client/src/types/FaciaApi.ts @@ -31,6 +31,7 @@ type Platform = 'Web' | 'Platform'; interface FrontsToolSettings { displayEditWarning?: boolean; + suppressImages?: boolean; } interface CollectionConfigResponse { diff --git a/test/fixtures/FakeCapiAndOphan.scala b/test/fixtures/FakeCapiAndOphan.scala index 778a993ba32..e18c37c22c6 100644 --- a/test/fixtures/FakeCapiAndOphan.scala +++ b/test/fixtures/FakeCapiAndOphan.scala @@ -12,7 +12,7 @@ import scala.concurrent.Future trait FakeCapiAndOphan { - private val allFalseMetadata = ResolvedMetaData(false, false, false, false, false, false, false, false, false, false, false, false, false, false) + private val allFalseMetadata = ResolvedMetaData(false, false, "boostLevel.default", false, false, false, false, false, false, false, false, false, false, false, false) private val imageUrl = "https://media.giphy.com/media/K3PYNk8oh3HGM/source.gif" diff --git a/test/services/editions/EditionsTemplatingTest.scala b/test/services/editions/EditionsTemplatingTest.scala index f32b5fd529b..6dc3cbca7e5 100644 --- a/test/services/editions/EditionsTemplatingTest.scala +++ b/test/services/editions/EditionsTemplatingTest.scala @@ -321,7 +321,7 @@ class EditionsTemplatingTest extends FreeSpec with Matchers with OptionValues wi } private def prefillWithCapiId(capiId: String): Prefill = { - val allFalseMetadata = ResolvedMetaData(false, false, false, false, false, false, false, false, false, false, false, false, false, false) + val allFalseMetadata = ResolvedMetaData(false, false, "boostLevel.default", false, false, false, false, false, false, false, false, false, false, false, false) Prefill( 222222, None, diff --git a/test/util/ContentUpgradeTest.scala b/test/util/ContentUpgradeTest.scala index 45a81afc8ac..37450a01881 100644 --- a/test/util/ContentUpgradeTest.scala +++ b/test/util/ContentUpgradeTest.scala @@ -82,20 +82,24 @@ class ContentUpgradeTest extends FreeSpec with Matchers { | "isHosted":true, | "frontsMeta":{ | "defaults":{ + | "boostLevel.gigaBoost":false, | "isBreaking":false, | "isBoosted":false, | "showMainVideo":false, | "imageHide":false, + | "boostLevel.default":true, | "showQuotedHeadline":false, | "imageSlideshowReplace":false, + | "boostLevel.boost":false, | "imageReplace":false, - | "showBoostedHeadline":false, | "showKickerCustom":false, | "showByline":false, | "showKickerTag":false, | "showLivePlayable":false, | "imageCutoutReplace":false, - | "showKickerSection":false}, + | "showKickerSection":false, + | "boostLevel.megaboost":false, + | "showBoostedHeadline":false}, | "tone":"news" | } | } @@ -174,20 +178,24 @@ class ContentUpgradeTest extends FreeSpec with Matchers { | "isHosted":true, | "frontsMeta":{ | "defaults":{ + | "boostLevel.gigaBoost":false, | "isBreaking":false, | "isBoosted":false, | "showMainVideo":false, | "imageHide":false, + | "boostLevel.default":true, | "showQuotedHeadline":true, | "imageSlideshowReplace":false, + | "boostLevel.boost":false, | "imageReplace":false, - | "showBoostedHeadline":false, | "showKickerCustom":false, | "showByline":true, | "showKickerTag":false, | "showLivePlayable":false, | "imageCutoutReplace":true, - | "showKickerSection":false}, + | "showKickerSection":false, + | "boostLevel.megaboost":false, + | "showBoostedHeadline":false}, | "tone":"comment", | "cutout":"cutout image location", | "mediaType":"Cutout" @@ -264,20 +272,24 @@ class ContentUpgradeTest extends FreeSpec with Matchers { | "isHosted":true, | "frontsMeta":{ | "defaults":{ + | "boostLevel.gigaBoost":false, | "isBreaking":false, | "isBoosted":false, | "showMainVideo":false, | "imageHide":false, + | "boostLevel.default":true, | "showQuotedHeadline":true, | "imageSlideshowReplace":false, + | "boostLevel.boost":false, | "imageReplace":false, - | "showBoostedHeadline":false, | "showKickerCustom":false, | "showByline":true, | "showKickerTag":false, | "showLivePlayable":false, | "imageCutoutReplace":false, - | "showKickerSection":false}, + | "showKickerSection":false, + | "boostLevel.megaboost":false, + | "showBoostedHeadline":false}, | "tone":"comment", | "mediaType":"UseArticleTrail" | } @@ -337,20 +349,24 @@ class ContentUpgradeTest extends FreeSpec with Matchers { | "isHosted":true, | "frontsMeta":{ | "defaults":{ + | "boostLevel.gigaBoost":false, | "isBreaking":false, | "isBoosted":false, | "showMainVideo":false, | "imageHide":false, + | "boostLevel.default":true, | "showQuotedHeadline":true, | "imageSlideshowReplace":false, + | "boostLevel.boost":false, | "imageReplace":false, - | "showBoostedHeadline":false, | "showKickerCustom":false, | "showByline":true, | "showKickerTag":false, | "showLivePlayable":false, | "imageCutoutReplace":false, - | "showKickerSection":false}, + | "showKickerSection":false, + | "boostLevel.megaboost":false, + | "showBoostedHeadline":false}, | "tone":"comment", | "mediaType":"UseArticleTrail" | } @@ -410,20 +426,24 @@ class ContentUpgradeTest extends FreeSpec with Matchers { | "isHosted":true, | "frontsMeta":{ | "defaults":{ + | "boostLevel.gigaBoost":false, | "isBreaking":false, | "isBoosted":false, | "showMainVideo":false, | "imageHide":false, + | "boostLevel.default":true, | "showQuotedHeadline":false, | "imageSlideshowReplace":false, + | "boostLevel.boost":false, | "imageReplace":false, - | "showBoostedHeadline":false, | "showKickerCustom":false, | "showByline":false, | "showKickerTag":false, | "showLivePlayable":false, | "imageCutoutReplace":false, - | "showKickerSection":false}, + | "showKickerSection":false, + | "boostLevel.megaboost":false, + | "showBoostedHeadline":false}, | "tone":"letters", | "pickedKicker":"Letters" | } @@ -483,20 +503,24 @@ class ContentUpgradeTest extends FreeSpec with Matchers { | "isHosted":true, | "frontsMeta":{ | "defaults":{ + | "boostLevel.gigaBoost":false, | "isBreaking":false, | "isBoosted":false, | "showMainVideo":false, | "imageHide":false, + | "boostLevel.default":true, | "showQuotedHeadline":false, | "imageSlideshowReplace":false, + | "boostLevel.boost":false, | "imageReplace":false, - | "showBoostedHeadline":false, | "showKickerCustom":false, | "showByline":false, | "showKickerTag":false, | "showLivePlayable":false, | "imageCutoutReplace":false, - | "showKickerSection":false}, + | "showKickerSection":false, + | "boostLevel.megaboost":false, + | "showBoostedHeadline":false}, | "tone":"editorial", | "pickedKicker":"Editorial" | } From 9404f0f7d019b1402c7c3be9a1d239280c932d42 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:30:25 +0100 Subject: [PATCH 2/7] use latest fapi client release (v11) --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 564927c8bce..a028aa11648 100644 --- a/build.sbt +++ b/build.sbt @@ -74,7 +74,7 @@ libraryDependencies ++= Seq( "com.gu" %% "content-api-client-aws" % "0.6", "com.gu" %% "content-api-client-default" % capiClientVersion, "com.gu" %% "editorial-permissions-client" % "3.0.0", - "com.gu" %% "fapi-client-play30" % "11.0.0-PREVIEW.gladd-suppress-images-property.2024-09-26T1303.d2af9509", + "com.gu" %% "fapi-client-play30" % "11.0.0", "com.gu" %% "mobile-notifications-api-models" % "3.0.0", "com.gu" %% "pan-domain-auth-play_3-0" % "4.0.0", From 563950ae0efa2b6bc9a6a712c63072fa2c0238bd Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:41:23 +0100 Subject: [PATCH 3/7] Bump fapi client and move suppressImages prop to CollectionConfigResponse --- build.sbt | 2 +- fronts-client/src/types/FaciaApi.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index a028aa11648..207170519aa 100644 --- a/build.sbt +++ b/build.sbt @@ -74,7 +74,7 @@ libraryDependencies ++= Seq( "com.gu" %% "content-api-client-aws" % "0.6", "com.gu" %% "content-api-client-default" % capiClientVersion, "com.gu" %% "editorial-permissions-client" % "3.0.0", - "com.gu" %% "fapi-client-play30" % "11.0.0", + "com.gu" %% "fapi-client-play30" % "12.0.0-PREVIEW.glmove-suppress-images-prop.2024-10-01T1416.1b3d50f2", "com.gu" %% "mobile-notifications-api-models" % "3.0.0", "com.gu" %% "pan-domain-auth-play_3-0" % "4.0.0", diff --git a/fronts-client/src/types/FaciaApi.ts b/fronts-client/src/types/FaciaApi.ts index 53788edc432..8ed0fb4444b 100644 --- a/fronts-client/src/types/FaciaApi.ts +++ b/fronts-client/src/types/FaciaApi.ts @@ -31,7 +31,6 @@ type Platform = 'Web' | 'Platform'; interface FrontsToolSettings { displayEditWarning?: boolean; - suppressImages?: boolean; } interface CollectionConfigResponse { @@ -55,6 +54,7 @@ interface CollectionConfigResponse { frontsToolSettings?: FrontsToolSettings; prefill?: EditionsPrefill; targetedTerritory?: string; + suppressImages?: boolean; } interface FrontsConfigResponse { From ae45e89d3d10f9d57b43e32f8a928fd4d3538b18 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:47:23 +0100 Subject: [PATCH 4/7] Add new suppressImages prop to test data --- test/config/TransformationsSpec.scala | 1 + test/services/CollectionServiceTest.scala | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/config/TransformationsSpec.scala b/test/config/TransformationsSpec.scala index 0297f593861..b31a6f5da52 100644 --- a/test/config/TransformationsSpec.scala +++ b/test/config/TransformationsSpec.scala @@ -56,6 +56,7 @@ class TransformationsSpec extends FlatSpec with Matchers { None, None, None, + None, None ) diff --git a/test/services/CollectionServiceTest.scala b/test/services/CollectionServiceTest.scala index 6c32620a339..9dc4b5dde7a 100644 --- a/test/services/CollectionServiceTest.scala +++ b/test/services/CollectionServiceTest.scala @@ -70,6 +70,7 @@ class CollectionServiceTest extends FreeSpec with Matchers { userVisibility = None, targetedTerritory = None, platform = None, - frontsToolSettings = None) + frontsToolSettings = None, + suppressImages = None) } } From 72228b7f2372872c60ddff89d000436340d99795 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:13:32 +0100 Subject: [PATCH 5/7] Use latest v12 release of fapi client --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 207170519aa..1472564c148 100644 --- a/build.sbt +++ b/build.sbt @@ -74,7 +74,7 @@ libraryDependencies ++= Seq( "com.gu" %% "content-api-client-aws" % "0.6", "com.gu" %% "content-api-client-default" % capiClientVersion, "com.gu" %% "editorial-permissions-client" % "3.0.0", - "com.gu" %% "fapi-client-play30" % "12.0.0-PREVIEW.glmove-suppress-images-prop.2024-10-01T1416.1b3d50f2", + "com.gu" %% "fapi-client-play30" % "12.0.0", "com.gu" %% "mobile-notifications-api-models" % "3.0.0", "com.gu" %% "pan-domain-auth-play_3-0" % "4.0.0", From ddffc782dade1794c57be46dca5585f5d6b5ddf7 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:14:35 +0100 Subject: [PATCH 6/7] Add suppress images property to config tool, propagate it to v2 and use it to display a message on the collection if images are suppressed --- fronts-client/src/components/CollectionDisplay.tsx | 6 ++++++ fronts-client/src/types/Collection.ts | 1 + fronts-client/src/util/frontsUtils.ts | 1 + public/src/js/models/config/collection.js | 3 ++- public/src/js/widgets/columns/fronts-config.html | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fronts-client/src/components/CollectionDisplay.tsx b/fronts-client/src/components/CollectionDisplay.tsx index 2b4f1dcebb9..c1c3b634d6c 100644 --- a/fronts-client/src/components/CollectionDisplay.tsx +++ b/fronts-client/src/components/CollectionDisplay.tsx @@ -311,6 +311,12 @@ class CollectionDisplay extends React.Component { {oc(collection).metadata[0].type()} ) : null} + {collection?.suppressImages ? ( + + | + Images suppressed + + ) : null} {collection && collection.platform && collection.platform !== 'Any' ? ( diff --git a/fronts-client/src/types/Collection.ts b/fronts-client/src/types/Collection.ts index b3a73275843..e3d6d1935f5 100644 --- a/fronts-client/src/types/Collection.ts +++ b/fronts-client/src/types/Collection.ts @@ -188,6 +188,7 @@ interface Collection { frontsToolSettings?: FrontsToolSettings; isHidden?: boolean; targetedTerritory?: string; + suppressImages?: boolean; } interface ArticleTag { diff --git a/fronts-client/src/util/frontsUtils.ts b/fronts-client/src/util/frontsUtils.ts index a6b1a60071a..f1a030f6c78 100644 --- a/fronts-client/src/util/frontsUtils.ts +++ b/fronts-client/src/util/frontsUtils.ts @@ -44,6 +44,7 @@ const combineCollectionWithConfig = ( platform: collectionConfig.platform, metadata: collectionConfig.metadata, targetedTerritory: collectionConfig.targetedTerritory, + suppressImages: collectionConfig.suppressImages, }); }; diff --git a/public/src/js/models/config/collection.js b/public/src/js/models/config/collection.js index 0fea881e8a5..ba5e5d7ed71 100644 --- a/public/src/js/models/config/collection.js +++ b/public/src/js/models/config/collection.js @@ -46,7 +46,8 @@ export default class ConfigCollection extends DropTarget { 'platform', 'frontsToolSettings', 'userVisibility', - 'targetedTerritory' + 'targetedTerritory', + 'suppressImages' ]), { displayHints: asObservableProps([ diff --git a/public/src/js/widgets/columns/fronts-config.html b/public/src/js/widgets/columns/fronts-config.html index 89017174b86..a47dda6380d 100644 --- a/public/src/js/widgets/columns/fronts-config.html +++ b/public/src/js/widgets/columns/fronts-config.html @@ -279,6 +279,9 @@ + + +
Platform: From d6bc4a62f6a9cf7ff775b5ea323d33af94bf1ba8 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:02:27 +0100 Subject: [PATCH 7/7] Ensure suppress images config option only appears on scrollable small containers --- public/src/js/widgets/columns/fronts-config.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/src/js/widgets/columns/fronts-config.html b/public/src/js/widgets/columns/fronts-config.html index a47dda6380d..7610438d2d8 100644 --- a/public/src/js/widgets/columns/fronts-config.html +++ b/public/src/js/widgets/columns/fronts-config.html @@ -279,8 +279,10 @@ + +
Platform: