From 6820ac093e36f7fe83a9079f8da8a572094c75cf Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:16:45 +0000 Subject: [PATCH 01/28] Change editions crosswords query We'd like to send a list of crosswords to DCAR, so this changes the structure of the data model. It also applies some of the solutions logic used in the similar `CrosswordData` model, widens the types of crosswords requested, and switches to a more specific CAPI search query. Note that it uses the CAPI client's `SearchQuery` directly rather than frontend's `contentApiClient.search`, as that includes a number of fields we don't need here. --- .../controllers/CrosswordsController.scala | 50 +++++++--- .../EditionsCrosswordRenderingDataModel.scala | 23 ++++- ...tionsCrosswordRenderingDataModelTest.scala | 96 +++++++++++++++++++ 3 files changed, 149 insertions(+), 20 deletions(-) create mode 100644 common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala diff --git a/applications/app/controllers/CrosswordsController.scala b/applications/app/controllers/CrosswordsController.scala index 48c16256bec..8a7c5b6f904 100644 --- a/applications/app/controllers/CrosswordsController.scala +++ b/applications/app/controllers/CrosswordsController.scala @@ -1,10 +1,16 @@ package controllers -import com.gu.contentapi.client.model.v1.CrosswordType.{Cryptic, Quick} -import com.gu.contentapi.client.model.v1.{Crossword, ItemResponse, Content => ApiContent, Section => ApiSection} +import com.gu.contentapi.client.model.v1.{ + Crossword, + ItemResponse, + SearchResponse, + Content => ApiContent, + Section => ApiSection, +} import common.{Edition, GuLogging, ImplicitControllerExecutionContext} import conf.Static import contentapi.ContentApiClient +import com.gu.contentapi.client.model.SearchQuery import crosswords.{ AccessibleCrosswordPage, AccessibleCrosswordRows, @@ -304,21 +310,35 @@ class CrosswordEditionsController( def digitalEdition: Action[AnyContent] = Action.async { implicit request => getCrosswords .map(parseCrosswords) - .flatMap { - case Some(crosswordPage) => - remoteRenderer.getEditionsCrossword(wsClient, crosswordPage) - case None => Future.successful(NotFound) + .flatMap { crosswords => + remoteRenderer.getEditionsCrossword(wsClient, crosswords) } } - private lazy val crosswordsQuery = contentApiClient.item("crosswords") - - private def getCrosswords: Future[ItemResponse] = contentApiClient.getResponse(crosswordsQuery) + private def getCrosswords: Future[SearchResponse] = + contentApiClient.getResponse(crosswordsQuery) + + /** Search for playable crosswords sorted by print publication date. This will exclude older, originally print-only + * crosswords that happen to have been re-published in a digital format recently. + */ + private lazy val crosswordsQuery = + SearchQuery() + .tag(crosswordTags) + .useDate("newspaper-edition") + .pageSize(25) + + private lazy val crosswordTags = Seq( + "crosswords/series/quick", + "crosswords/series/cryptic", + "crosswords/series/prize", + "crosswords/series/weekend-crossword", + "crosswords/series/quick-cryptic", + "crosswords/series/everyman", + "crosswords/series/speedy", + "crosswords/series/quiptic", + ).mkString("|") + + private def parseCrosswords(response: SearchResponse): EditionsCrosswordRenderingDataModel = + EditionsCrosswordRenderingDataModel(response.results.flatMap(_.crossword)) - private def parseCrosswords(response: ItemResponse): Option[EditionsCrosswordRenderingDataModel] = - for { - results <- response.results - quick <- results.find(_.crossword.exists(_.`type` == Quick)).flatMap(_.crossword) - cryptic <- results.find(_.crossword.exists(_.`type` == Cryptic)).flatMap(_.crossword) - } yield EditionsCrosswordRenderingDataModel(quick, cryptic) } diff --git a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala index 92cfff9ec8a..180e91803ac 100644 --- a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala @@ -4,17 +4,30 @@ import com.gu.contentapi.client.model.v1.Crossword import com.gu.contentapi.json.CirceEncoders._ import io.circe.JsonObject import io.circe.syntax._ +import implicits.Dates.CapiRichDateTime case class EditionsCrosswordRenderingDataModel( - quick: Crossword, - cryptic: Crossword, + crosswords: Iterable[Crossword], ) object EditionsCrosswordRenderingDataModel { + def apply(crosswords: Iterable[Crossword]): EditionsCrosswordRenderingDataModel = + new EditionsCrosswordRenderingDataModel(crosswords.map(crossword => { + val shipSolutions = + crossword.dateSolutionAvailable + .map(_.toJoda.isBeforeNow) + .getOrElse(crossword.solutionAvailable) + + if (shipSolutions) { + crossword + } else { + crossword.copy(entries = crossword.entries.map(_.copy(solution = None))) + } + })) + def toJson(model: EditionsCrosswordRenderingDataModel): String = { JsonObject( - "quick" -> model.quick.asJson.dropNullValues, - "cryptic" -> model.cryptic.asJson.dropNullValues, - ).asJson.dropNullValues.noSpaces + "crosswords" -> model.crosswords.asJson.deepDropNullValues, + ).asJson.noSpaces } } diff --git a/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala b/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala new file mode 100644 index 00000000000..1b3b97841e6 --- /dev/null +++ b/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala @@ -0,0 +1,96 @@ +package model.dotcomrendering + +import com.gu.contentapi.client.model.v1.{CapiDateTime, Crossword, CrosswordType, CrosswordDimensions, CrosswordEntry} +import model.dotcomrendering.pageElements.EditionsCrosswordRenderingDataModel +import org.mockito.Mockito.when +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers +import org.scalatestplus.mockito.MockitoSugar +import org.joda.time.DateTime + +class EditionsCrosswordRenderingDataModelTest extends AnyFlatSpec with Matchers with MockitoSugar { + val mockEntry = CrosswordEntry( + id = "mockId", + solution = Some("Mock solution"), + ) + + val mockCrossword = Crossword( + name = "Mock name", + `type` = CrosswordType.Quick, + number = 1, + date = CapiDateTime(DateTime.now().getMillis(), "date"), + dimensions = CrosswordDimensions(1, 1), + entries = Seq(mockEntry, mockEntry), + solutionAvailable = true, + hasNumbers = false, + randomCluesOrdering = false, + ) + + "apply" should "provide solutions when 'dateSolutionAvailable' is in the past" in { + val crossword = mockCrossword.copy( + solutionAvailable = true, + dateSolutionAvailable = Some(CapiDateTime(DateTime.now().minusDays(1).getMillis(), "date")), + ) + + val crosswords = + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) + .crosswords + .toSeq + + crosswords(0).entries(0).solution shouldBe Some("Mock solution") + crosswords(0).entries(1).solution shouldBe Some("Mock solution") + crosswords(1).entries(0).solution shouldBe Some("Mock solution") + crosswords(1).entries(1).solution shouldBe Some("Mock solution") + } + + "apply" should "provide solutions when 'dateSolutionAvailable' is 'None' and solutionAvailable is 'true'" in { + val crossword = mockCrossword.copy( + solutionAvailable = true, + dateSolutionAvailable = None, + ) + + val crosswords = + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) + .crosswords + .toSeq + + crosswords(0).entries(0).solution shouldBe Some("Mock solution") + crosswords(0).entries(1).solution shouldBe Some("Mock solution") + crosswords(1).entries(0).solution shouldBe Some("Mock solution") + crosswords(1).entries(1).solution shouldBe Some("Mock solution") + } + + "apply" should "not provide solutions when 'dateSolutionAvailable' is in the future" in { + val crossword = mockCrossword.copy( + solutionAvailable = true, + dateSolutionAvailable = Some(CapiDateTime(DateTime.now().plusDays(1).getMillis(), "date")), + ) + + val crosswords = + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) + .crosswords + .toSeq + + crosswords(0).entries(0).solution shouldBe None + crosswords(0).entries(1).solution shouldBe None + crosswords(1).entries(0).solution shouldBe None + crosswords(1).entries(1).solution shouldBe None + } + + "apply" should "not provide solutions when 'dateSolutionAvailable' is 'None' and solutionAvailable is 'false'" in { + val crossword = mockCrossword.copy( + solutionAvailable = false, + dateSolutionAvailable = None, + ) + + val crosswords = + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) + .crosswords + .toSeq + + crosswords(0).entries(0).solution shouldBe None + crosswords(0).entries(1).solution shouldBe None + crosswords(1).entries(0).solution shouldBe None + crosswords(1).entries(1).solution shouldBe None + } +} From ce20d5495d7b36d73868a81199e4614accb6124e Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Fri, 29 Nov 2024 12:21:12 +0100 Subject: [PATCH 02/28] sbt 1.0.5 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 0b699c3052d..db1723b0862 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.5 From 57b59bd2cd169e2e39deef5bb59fdccbf4381c46 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Fri, 29 Nov 2024 12:22:44 +0100 Subject: [PATCH 03/28] sbt-git upgrade --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 1d2e90e7904..e26292ebac3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -15,7 +15,7 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4") -addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1") +addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") From d8a5e3f6c733883648157ef5eca1767489b73e43 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Fri, 29 Nov 2024 12:22:56 +0100 Subject: [PATCH 04/28] sbt-buildinfo upgrade --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index e26292ebac3..8b002e87c6d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -21,4 +21,4 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addDependencyTreePlugin -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1") From bfc829794121f680ae849125beb237a4c960f481 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Fri, 29 Nov 2024 12:23:13 +0100 Subject: [PATCH 05/28] Play 3.0.6 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 8b002e87c6d..104d4f1afe1 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,7 +9,7 @@ libraryDependencies ++= Seq( resolvers ++= Resolver.sonatypeOssRepos("releases") -addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.5") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.6") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4") From 9cf307c25d6cb7fd7c3d6d1314261dc0ebb65718 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Fri, 29 Nov 2024 12:28:06 +0100 Subject: [PATCH 06/28] Scala 2.13.15 --- project/ProjectSettings.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/ProjectSettings.scala b/project/ProjectSettings.scala index f40137aa9a3..c1f41d0c79b 100644 --- a/project/ProjectSettings.scala +++ b/project/ProjectSettings.scala @@ -32,7 +32,7 @@ object ProjectSettings { Compile / packageDoc / publishArtifact := false, Compile / doc / sources := Seq.empty, Compile / doc := target.map(_ / "none").value, - scalaVersion := "2.13.14", + scalaVersion := "2.13.15", cleanAll := Def.taskDyn { val allProjects = ScopeFilter(inAnyProject) clean.all(allProjects) From 58b4a4257c43ede561da71547dde287a767662a8 Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:17:19 +0000 Subject: [PATCH 07/28] Run scalafmt --- ...itionsCrosswordRenderingDataModelTest.scala | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala b/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala index 1b3b97841e6..5dc1d09d898 100644 --- a/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala +++ b/common/test/model/dotcomrendering/EditionsCrosswordRenderingDataModelTest.scala @@ -33,9 +33,7 @@ class EditionsCrosswordRenderingDataModelTest extends AnyFlatSpec with Matchers ) val crosswords = - EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) - .crosswords - .toSeq + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)).crosswords.toSeq crosswords(0).entries(0).solution shouldBe Some("Mock solution") crosswords(0).entries(1).solution shouldBe Some("Mock solution") @@ -50,9 +48,7 @@ class EditionsCrosswordRenderingDataModelTest extends AnyFlatSpec with Matchers ) val crosswords = - EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) - .crosswords - .toSeq + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)).crosswords.toSeq crosswords(0).entries(0).solution shouldBe Some("Mock solution") crosswords(0).entries(1).solution shouldBe Some("Mock solution") @@ -67,10 +63,8 @@ class EditionsCrosswordRenderingDataModelTest extends AnyFlatSpec with Matchers ) val crosswords = - EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) - .crosswords - .toSeq - + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)).crosswords.toSeq + crosswords(0).entries(0).solution shouldBe None crosswords(0).entries(1).solution shouldBe None crosswords(1).entries(0).solution shouldBe None @@ -84,9 +78,7 @@ class EditionsCrosswordRenderingDataModelTest extends AnyFlatSpec with Matchers ) val crosswords = - EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)) - .crosswords - .toSeq + EditionsCrosswordRenderingDataModel(Seq(crossword, crossword)).crosswords.toSeq crosswords(0).entries(0).solution shouldBe None crosswords(0).entries(1).solution shouldBe None From dc38754f12dc598357f909bb61b6a0b5898624eb Mon Sep 17 00:00:00 2001 From: DanielCliftonGuardian <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:02:22 +0000 Subject: [PATCH 08/28] Editions crossword json route Co-Authored-By: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Co-Authored-By: Marjan Kalanaki <15894063+marjisound@users.noreply.github.com> Co-Authored-By: Simon Adcock <5931528+SiAdcock@users.noreply.github.com> Co-Authored-By: Frederick O'Brien --- applications/app/controllers/CrosswordsController.scala | 9 +++++++++ applications/conf/routes | 1 + dev-build/conf/routes | 1 + 3 files changed, 11 insertions(+) diff --git a/applications/app/controllers/CrosswordsController.scala b/applications/app/controllers/CrosswordsController.scala index 8a7c5b6f904..9e35a35948a 100644 --- a/applications/app/controllers/CrosswordsController.scala +++ b/applications/app/controllers/CrosswordsController.scala @@ -24,6 +24,7 @@ import html.HtmlPageHelpers.ContentCSSFile import model.Cached.{RevalidatableResult, WithoutRevalidationResult} import model._ import model.dotcomrendering.pageElements.EditionsCrosswordRenderingDataModel +import model.dotcomrendering.pageElements.EditionsCrosswordRenderingDataModel.toJson import model.dotcomrendering.{DotcomRenderingDataModel, PageType} import org.joda.time.{DateTime, LocalDate} import pages.{CrosswordHtmlPage, IndexHtmlPage, PrintableCrosswordHtmlPage} @@ -315,6 +316,14 @@ class CrosswordEditionsController( } } + def digitalEditionJson: Action[AnyContent] = Action.async { implicit request => + getCrosswords + .map(parseCrosswords) + .map { crosswords => + Cached(CacheTime.Default)(RevalidatableResult.Ok(toJson(crosswords))).as("application/json") + } + } + private def getCrosswords: Future[SearchResponse] = contentApiClient.getResponse(crosswordsQuery) diff --git a/applications/conf/routes b/applications/conf/routes index e17e9272bd6..2cc50e84c62 100644 --- a/applications/conf/routes +++ b/applications/conf/routes @@ -29,6 +29,7 @@ GET /crosswords/lookup # Crosswords digital edition GET /crosswords/digital-edition controllers.CrosswordEditionsController.digitalEdition +GET /crosswords/digital-edition.json controllers.CrosswordEditionsController.digitalEditionJson # Email paths GET /email/form/$emailType/$listId<[0-9]+> controllers.EmailSignupController.renderForm(emailType: String, listId: Int) diff --git a/dev-build/conf/routes b/dev-build/conf/routes index a913457e946..8329b037133 100644 --- a/dev-build/conf/routes +++ b/dev-build/conf/routes @@ -31,6 +31,7 @@ GET /crosswords/lookup # Crosswords digital edition GET /crosswords/digital-edition controllers.CrosswordEditionsController.digitalEdition +GET /crosswords/digital-edition.json controllers.CrosswordEditionsController.digitalEditionJson # Email paths GET /email/form/$emailType/$listId<[0-9]+> controllers.EmailSignupController.renderForm(emailType: String, listId: Int) From 59a82e0f8ad8baa546473f44e433be17f1a2d4d1 Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:11:25 +0000 Subject: [PATCH 09/28] Add test summary to CI (#27648) Updated our test config to output test summary files. Added a step to the `build` workflow in GitHub actions to read from these files and output a summary in the GitHub UI. --- .github/workflows/build.yml | 6 ++++++ .gitignore | 1 + project/ProjectSettings.scala | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0668a2e5e7d..3ec4a2059e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,12 @@ jobs: -DAPP_SECRET="fake_secret" \ -Duser.timezone=Australia/Sydney \ -jar ./bin/sbt-launch.jar clean compile assets scalafmtCheckAll test Universal/packageBin + + - name: Test Summary + uses: test-summary/action@v2 + with: + paths: "test-results/**/TEST-*.xml" + if: always() - uses: guardian/actions-riff-raff@v4 env: diff --git a/.gitignore b/.gitignore index 6fbf8f6de5c..725f9848c0d 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ static/src/stylesheets/pasteup/.npmrc metals.sbt .java-version +test-results/ diff --git a/project/ProjectSettings.scala b/project/ProjectSettings.scala index f40137aa9a3..f906b47f73d 100644 --- a/project/ProjectSettings.scala +++ b/project/ProjectSettings.scala @@ -55,8 +55,7 @@ object ProjectSettings { def testStage = if (isCi) "DEVINFRA" else "LOCALTEST" val frontendTestSettings = Seq( - // Use ScalaTest https://groups.google.com/d/topic/play-framework/rZBfNoGtC0M/discussion - Test / testOptions := Nil, + Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", s"test-results/scala-${scalaVersion.value}", "-o"), concurrentRestrictions in Global := List(Tags.limit(Tags.Test, 4)), // Copy unit test resources https://groups.google.com/d/topic/play-framework/XD3X6R-s5Mc/discussion Test / unmanagedClasspath += (baseDirectory map { bd => Attributed.blank(bd / "test") }).value, From cdd23dddfe81ef2e387d1a34d225f68f9841d273 Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:40:28 +0000 Subject: [PATCH 10/28] Add `contentType` to editions crosswords query (#27656) Excludes any crosswords that are not playable. These will not be published with the "crossword" content type. --- applications/app/controllers/CrosswordsController.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/app/controllers/CrosswordsController.scala b/applications/app/controllers/CrosswordsController.scala index 9e35a35948a..dbbe78e15f3 100644 --- a/applications/app/controllers/CrosswordsController.scala +++ b/applications/app/controllers/CrosswordsController.scala @@ -332,6 +332,7 @@ class CrosswordEditionsController( */ private lazy val crosswordsQuery = SearchQuery() + .contentType("crossword") .tag(crosswordTags) .useDate("newspaper-edition") .pageSize(25) From 67ec26d9055f8e82daeb7bf91f94469f85e7a104 Mon Sep 17 00:00:00 2001 From: DanielCliftonGuardian <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:22:16 +0000 Subject: [PATCH 11/28] Remove accreditation logo --- common/app/views/fragments/header.scala.html | 2 -- .../views/fragments/headerTopNav.scala.html | 4 --- .../logo/guardian-news-provider-logo.svg | 34 ------------------- .../layout/nav/_header-top-nav.scss | 2 +- 4 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 static/src/inline-svgs/logo/guardian-news-provider-logo.svg diff --git a/common/app/views/fragments/header.scala.html b/common/app/views/fragments/header.scala.html index ffbdc59f6d8..816c93037d9 100644 --- a/common/app/views/fragments/header.scala.html +++ b/common/app/views/fragments/header.scala.html @@ -28,8 +28,6 @@ @{ if(page.metadata.hasSlimHeader) { fragments.inlineSvg("the-guardian-roundel", "logo") - } else if(editionId == "uk") { - fragments.inlineSvg("guardian-news-provider-logo", "logo") } else { fragments.inlineSvg("the-guardian-logo", "logo") } diff --git a/common/app/views/fragments/headerTopNav.scala.html b/common/app/views/fragments/headerTopNav.scala.html index 9b026f957b5..b722990879e 100644 --- a/common/app/views/fragments/headerTopNav.scala.html +++ b/common/app/views/fragments/headerTopNav.scala.html @@ -152,12 +152,8 @@ The Guardian - Back to home @{ - if(editionId == "uk") { - fragments.inlineSvg("guardian-news-provider-logo", "logo") - } else { fragments.inlineSvg("the-guardian-logo", "logo") } - } }
diff --git a/static/src/inline-svgs/logo/guardian-news-provider-logo.svg b/static/src/inline-svgs/logo/guardian-news-provider-logo.svg deleted file mode 100644 index ee15e9b658b..00000000000 --- a/static/src/inline-svgs/logo/guardian-news-provider-logo.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/static/src/stylesheets/layout/nav/_header-top-nav.scss b/static/src/stylesheets/layout/nav/_header-top-nav.scss index 508fd7b2021..306ee1186b1 100644 --- a/static/src/stylesheets/layout/nav/_header-top-nav.scss +++ b/static/src/stylesheets/layout/nav/_header-top-nav.scss @@ -250,7 +250,7 @@ from scrolling */ } } -.inline-guardian-best-website-logo, .inline-guardian-news-provider-logo, +.inline-guardian-best-website-logo, .inline-guardian-best-newspaper-logo { display: block; height: auto; From d09041fdb280e627b483a541868dae031eceff3c Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Tue, 10 Dec 2024 15:48:57 +0000 Subject: [PATCH 12/28] Centre gallery ad slots --- applications/app/views/fragments/gallerySlot.scala.html | 1 + static/src/stylesheets/module/_adslot.scss | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/app/views/fragments/gallerySlot.scala.html b/applications/app/views/fragments/gallerySlot.scala.html index 29653b20cd6..22c713fd6e9 100644 --- a/applications/app/views/fragments/gallerySlot.scala.html +++ b/applications/app/views/fragments/gallerySlot.scala.html @@ -13,5 +13,6 @@ Map(), optId = if(isMobile) Some(s"$slotName--mobile") else None, optClassNames = if(isMobile) Some("mobile-only") else Some("hide-until-tablet") + useFlexContainer = true ){ } } diff --git a/static/src/stylesheets/module/_adslot.scss b/static/src/stylesheets/module/_adslot.scss index 7332dc9c8b2..c60efbc948b 100644 --- a/static/src/stylesheets/module/_adslot.scss +++ b/static/src/stylesheets/module/_adslot.scss @@ -192,7 +192,7 @@ .ad-slot--gallery-inline, .ad-slot--liveblog-inline { width: $mpu-original-width; - margin: $gs-baseline auto; + margin: $gs-baseline 0; min-width: $mpu-original-width; min-height: $mpu-original-height + $mpu-ad-label-height; text-align: center; From b1d5bdba22b4e2e3d2e16a7fc693fd49f03976ac Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Tue, 10 Dec 2024 16:19:22 +0000 Subject: [PATCH 13/28] Add missing comma --- applications/app/views/fragments/gallerySlot.scala.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/app/views/fragments/gallerySlot.scala.html b/applications/app/views/fragments/gallerySlot.scala.html index 22c713fd6e9..303803d2a41 100644 --- a/applications/app/views/fragments/gallerySlot.scala.html +++ b/applications/app/views/fragments/gallerySlot.scala.html @@ -12,7 +12,7 @@ Seq("gallery-inline", "dark") ++ (if(isMobile) Some("mobile") else None), Map(), optId = if(isMobile) Some(s"$slotName--mobile") else None, - optClassNames = if(isMobile) Some("mobile-only") else Some("hide-until-tablet") + optClassNames = if(isMobile) Some("mobile-only") else Some("hide-until-tablet"), useFlexContainer = true ){ } } From adaa61278ce0c39e2e599f9b4efd8ae385c5cf41 Mon Sep 17 00:00:00 2001 From: Daniel Clifton <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:46:58 +0000 Subject: [PATCH 14/28] Increase timeout for post to DCR fronts in dev (#27660) * Increase timeout --- common/app/renderers/DotcomRenderingService.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/app/renderers/DotcomRenderingService.scala b/common/app/renderers/DotcomRenderingService.scala index 32d7e067a59..a02f30f4e33 100644 --- a/common/app/renderers/DotcomRenderingService.scala +++ b/common/app/renderers/DotcomRenderingService.scala @@ -258,6 +258,13 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload }) } + private def getTimeout: Duration = { + if (Configuration.environment.stage == "DEV") + Configuration.rendering.timeout * 5 + else + Configuration.rendering.timeout + } + def getFront( ws: WSClient, page: PressedPage, @@ -278,7 +285,8 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload ) val json = DotcomFrontsRenderingDataModel.toJson(dataModel) - post(ws, json, Configuration.rendering.faciaBaseURL + "/Front", CacheTime.Facia) + val timeout = getTimeout + post(ws, json, Configuration.rendering.faciaBaseURL + "/Front", CacheTime.Facia, timeout) } def getTagPage( From a78e142e78852c3d11d6e6c1178ec3e55a00dc15 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Wed, 11 Dec 2024 15:23:38 +0000 Subject: [PATCH 15/28] Bump commercial to 23.7.5 --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index fd9b5b8df55..98642c0fcc1 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@emotion/react": "11.11.1", "@emotion/styled": "^10.0.27", "@guardian/ab-core": "8.0.0", - "@guardian/commercial": "23.7.4", + "@guardian/commercial": "23.7.5", "@guardian/core-web-vitals": "6.0.0", "@guardian/eslint-config-typescript": "9.0.1", "@guardian/identity-auth": "3.0.0", diff --git a/yarn.lock b/yarn.lock index 1e9a106e39b..5579fc3d3ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3607,9 +3607,9 @@ __metadata: languageName: node linkType: hard -"@guardian/commercial@npm:23.7.4": - version: 23.7.4 - resolution: "@guardian/commercial@npm:23.7.4" +"@guardian/commercial@npm:23.7.5": + version: 23.7.5 + resolution: "@guardian/commercial@npm:23.7.5" dependencies: "@guardian/prebid.js": "npm:8.52.0-8" "@octokit/core": "npm:^6.1.2" @@ -3626,7 +3626,7 @@ __metadata: "@guardian/libs": ^19.1.0 "@guardian/source": ^8.0.0 typescript: ~5.5.3 - checksum: 10c0/09fa6f6f237ff0a2bd81d4e9bf4203f4fe37bff33c963401217f5f5e513da505ccc9fab1284e8d732f8d77cff0927141fb7a67dfd60986f5fa91d27b47d5fd0a + checksum: 10c0/1f6dddf3b6539d0c7d275804e0429fa2dd4b301e162131c2b0a112f5b8dd4b37770343c916dfd57bb2c77570a5c730d5fd66dcc6d30d893386665fcb7b2423a9 languageName: node linkType: hard @@ -3699,7 +3699,7 @@ __metadata: "@emotion/react": "npm:11.11.1" "@emotion/styled": "npm:^10.0.27" "@guardian/ab-core": "npm:8.0.0" - "@guardian/commercial": "npm:23.7.4" + "@guardian/commercial": "npm:23.7.5" "@guardian/core-web-vitals": "npm:6.0.0" "@guardian/eslint-config-typescript": "npm:9.0.1" "@guardian/identity-auth": "npm:3.0.0" From 88eb8a0b4017f700ab058eed410e7ed7a3296f5c Mon Sep 17 00:00:00 2001 From: Anna Beddow Date: Thu, 12 Dec 2024 09:57:43 +0000 Subject: [PATCH 16/28] Add gallery count to PressedCard --- common/app/model/PressedCard.scala | 15 +++++++++++++++ common/test/common/TrailsToShowcaseTest.scala | 1 + common/test/common/facia/FixtureBuilder.scala | 1 + 3 files changed, 17 insertions(+) diff --git a/common/app/model/PressedCard.scala b/common/app/model/PressedCard.scala index 15a3f214d3a..8b03acabd63 100644 --- a/common/app/model/PressedCard.scala +++ b/common/app/model/PressedCard.scala @@ -7,6 +7,7 @@ import com.gu.facia.api.utils.FaciaContentUtils.fold import com.gu.facia.api.{models => fapi, utils => fapiutils} import model.CardStylePicker import org.joda.time.DateTime +import com.gu.contentapi.client.model.v1.{Content, ElementType} final case class PressedCard( id: String, @@ -20,6 +21,7 @@ final case class PressedCard( shortUrl: String, group: String, isLive: Boolean, + galleryCount: Option[Int], ) { def withoutTrailText: PressedCard = copy(trailText = None) } @@ -36,6 +38,18 @@ object PressedCard { ).map(_.toJodaDateTime) } + def extractGalleryCount(fc: FaciaContent): Option[Int] = { + def countImagesInGallery(content: Content): Option[Int] = + content.elements.map(_.count(el => el.`type` == ElementType.Image && el.relation == "gallery")).filter(_ > 0) + + fold(fc)( + curatedContent => countImagesInGallery(curatedContent.content), + supportingCuratedContent => countImagesInGallery(supportingCuratedContent.content), + _ => None, + latestSnap => latestSnap.latestContent.flatMap(countImagesInGallery), + ) + } + PressedCard( id = FaciaContentUtils.id(content), cardStyle = CardStyle.make(CardStylePicker(content)), @@ -48,6 +62,7 @@ object PressedCard { group = FaciaContentUtils.group(content), trailText = FaciaContentUtils.trailText(content), starRating = FaciaContentUtils.starRating(content), + galleryCount = extractGalleryCount(content), ) } } diff --git a/common/test/common/TrailsToShowcaseTest.scala b/common/test/common/TrailsToShowcaseTest.scala index 889115e853a..48c28867d62 100644 --- a/common/test/common/TrailsToShowcaseTest.scala +++ b/common/test/common/TrailsToShowcaseTest.scala @@ -1394,6 +1394,7 @@ class TrailsToShowcaseTest extends AnyFlatSpec with Matchers with EitherValues { shortUrlPath = None, isLive = true, group = "", + galleryCount = None, ) val discussionSettings = PressedDiscussionSettings( diff --git a/common/test/common/facia/FixtureBuilder.scala b/common/test/common/facia/FixtureBuilder.scala index 604c7a1ce14..3b5d52cd769 100644 --- a/common/test/common/facia/FixtureBuilder.scala +++ b/common/test/common/facia/FixtureBuilder.scala @@ -99,6 +99,7 @@ object FixtureBuilder { shortUrl = "", group = "0", isLive = false, + galleryCount = None, ) def mkDiscussion(): PressedDiscussionSettings = From f7742fcbaf53a81f5d1e01f274fe3e36474a47a2 Mon Sep 17 00:00:00 2001 From: Dominik Lander Date: Thu, 12 Dec 2024 12:31:42 +0000 Subject: [PATCH 17/28] fix end date in us banner test --- .../modules/experiments/tests/usa-expandable-marketing-card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/src/javascripts/projects/common/modules/experiments/tests/usa-expandable-marketing-card.js b/static/src/javascripts/projects/common/modules/experiments/tests/usa-expandable-marketing-card.js index 0b45e0f5c6c..fbf877997c8 100644 --- a/static/src/javascripts/projects/common/modules/experiments/tests/usa-expandable-marketing-card.js +++ b/static/src/javascripts/projects/common/modules/experiments/tests/usa-expandable-marketing-card.js @@ -1,7 +1,7 @@ export const UsaExpandableMarketingCard = { id: 'UsaExpandableMarketingCard', start: '2024-11-18', - expiry: '2024-01-29', + expiry: '2025-01-29', author: 'dotcom.platform@guardian.co.uk', description: 'Test the impact of showing the user a component that highlights the Guardians journalism.', From f5b0956933023423846c494a5690910fc5a69af1 Mon Sep 17 00:00:00 2001 From: Dominik Lander Date: Thu, 12 Dec 2024 12:29:51 +0000 Subject: [PATCH 18/28] Start Onwards content test --- .../modules/experiments/tests/onwards-content-article.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/src/javascripts/projects/common/modules/experiments/tests/onwards-content-article.js b/static/src/javascripts/projects/common/modules/experiments/tests/onwards-content-article.js index 3cdf4fc812f..bdc9b44fcdc 100644 --- a/static/src/javascripts/projects/common/modules/experiments/tests/onwards-content-article.js +++ b/static/src/javascripts/projects/common/modules/experiments/tests/onwards-content-article.js @@ -5,8 +5,8 @@ export const onwardsContentArticle = { author: 'dotcom.platform@guardian.co.uk', description: 'Test the impact of showing the galleries onwards content component on article pages.', - audience: 0 / 100, - audienceOffset: 0 / 100, + audience: 50 / 100, + audienceOffset: 50 / 100, audienceCriteria: 'Article pages', successMeasure: 'Users are more likely to click a link in the onward content component.', From 7ce03f920800ef8bb0f4f07d6f19e802f9e3c76e Mon Sep 17 00:00:00 2001 From: Mahesh Makani Date: Thu, 12 Dec 2024 09:26:13 +0000 Subject: [PATCH 19/28] chore(deps): bump `@guardian/identity-auth-frontend` --- package.json | 2 +- yarn.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 98642c0fcc1..a62588727c1 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@guardian/core-web-vitals": "6.0.0", "@guardian/eslint-config-typescript": "9.0.1", "@guardian/identity-auth": "3.0.0", - "@guardian/identity-auth-frontend": "4.0.0", + "@guardian/identity-auth-frontend": "6.0.3", "@guardian/libs": "19.1.0", "@guardian/prettier": "^8.0.1", "@guardian/shimport": "^1.0.2", diff --git a/yarn.lock b/yarn.lock index 5579fc3d3ec..0ded5847fca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3703,7 +3703,7 @@ __metadata: "@guardian/core-web-vitals": "npm:6.0.0" "@guardian/eslint-config-typescript": "npm:9.0.1" "@guardian/identity-auth": "npm:3.0.0" - "@guardian/identity-auth-frontend": "npm:4.0.0" + "@guardian/identity-auth-frontend": "npm:6.0.3" "@guardian/libs": "npm:19.1.0" "@guardian/prettier": "npm:^8.0.1" "@guardian/shimport": "npm:^1.0.2" @@ -3832,18 +3832,18 @@ __metadata: languageName: unknown linkType: soft -"@guardian/identity-auth-frontend@npm:4.0.0": - version: 4.0.0 - resolution: "@guardian/identity-auth-frontend@npm:4.0.0" +"@guardian/identity-auth-frontend@npm:6.0.3": + version: 6.0.3 + resolution: "@guardian/identity-auth-frontend@npm:6.0.3" peerDependencies: - "@guardian/identity-auth": ^2.1.0 - "@guardian/libs": ^16.0.0 + "@guardian/identity-auth": ^4.0.1 + "@guardian/libs": ^19.0.0 tslib: ^2.6.2 - typescript: ~5.3.3 + typescript: ~5.5.2 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/b56e78e9a0477534e074936e4c93ae55c219e56fd0ded1c26a063c20ad5dbef09210fd404776f0ad96ef7ca34f209568eb61f3a296695afc3ea9329d8f61b8bc + checksum: 10c0/cf39465b55f07dd02a99cbdf10937f0a74797042430b9a50d1259c0f655e272aa1d6a086efece26ace22cde4fa45aab502c16fb155a125f08419b7756084cb1d languageName: node linkType: hard From 9c8a254be786fc37eb7b1eec591c6df7987ec317 Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:07:14 +0000 Subject: [PATCH 20/28] Use `JsValue` Not `String` For DCAR (#27641) Frontend posts the data for articles, fronts, tags pages and so on to DCAR as JSON, using `WSClient`. At the moment the following steps are taken to transform from an instance of a case class in frontend to the format that `WSClient` uses (`BodyWritable`): ``` case class instance -> JsValue -> String -> BodyWritable ``` The final transformation here, `String -> BodyWritable`, is handled by `WSClient`, as it defines an implicit way to get from one type to the other. However, it also defines a way to do this for a `play-json` `JsValue`, so we do not need to convert to a `String` beforehand. We should be able to pass a `JsValue` to `WSClient` directly, removing one of the transformation steps: ``` case class instance -> JsValue -> BodyWritable ``` The way to achieve this is by modifying our methods that use `WSClient.post` to take a `JsValue` payload instead of a `String`. We are then able to update the `toJson` methods on each of our models to remove the `Json.stringify` step. However, aside from `RemoteRender` requests, these `toJson` methods are also used to provide for `JsonFormat` requests via the `renderJson` method, which at the moment requires a `String`. This method, though, makes use of Play's `Writeable`, which also includes an implicit transformation to get from a `play-json` `JsValue`. So we can update it to take a `JsValue` instead, and save the additional `String` transformation step here too. Note that there is one exception where we're using `circe` instead of `play-json`, for crosswords, so in that case we're transforming from one to the other via `String`. --- .../app/controllers/CrosswordsController.scala | 3 ++- .../app/controllers/GalleryController.scala | 3 ++- .../app/controllers/ImageContentController.scala | 2 +- applications/app/controllers/MediaController.scala | 4 ++-- article/app/controllers/ArticleController.scala | 4 ++-- common/app/common/package.scala | 7 +++++-- .../DotcomBlocksRenderingDataModel.scala | 4 ++-- .../DotcomFrontsRenderingDataModel.scala | 4 ++-- .../DotcomNewslettersPageRenderingDataModel.scala | 4 ++-- .../dotcomrendering/DotcomRenderingDataModel.scala | 4 ++-- .../DotcomTagPagesRenderingDataModel.scala | 4 ++-- .../EditionsCrosswordRenderingDataModel.scala | 14 ++++++++------ common/app/renderers/DotcomRenderingService.scala | 5 +++-- .../renderers/DotcomRenderingServiceTest.scala | 3 ++- 14 files changed, 37 insertions(+), 28 deletions(-) diff --git a/applications/app/controllers/CrosswordsController.scala b/applications/app/controllers/CrosswordsController.scala index dbbe78e15f3..d7808690e63 100644 --- a/applications/app/controllers/CrosswordsController.scala +++ b/applications/app/controllers/CrosswordsController.scala @@ -30,6 +30,7 @@ import org.joda.time.{DateTime, LocalDate} import pages.{CrosswordHtmlPage, IndexHtmlPage, PrintableCrosswordHtmlPage} import play.api.data.Forms._ import play.api.data._ +import play.api.libs.json.JsValue import play.api.libs.ws.WSClient import play.api.mvc._ import renderers.DotcomRenderingService @@ -124,7 +125,7 @@ class CrosswordPageController( } private def getDCRJson(crosswordPage: CrosswordPageWithContent, pageType: PageType)(implicit request: RequestHeader, - ): String = + ): JsValue = DotcomRenderingDataModel.toJson( DotcomRenderingDataModel.forCrossword(crosswordPage, request, pageType), ) diff --git a/applications/app/controllers/GalleryController.scala b/applications/app/controllers/GalleryController.scala index fc749a3ab4a..65fa2b76e6c 100644 --- a/applications/app/controllers/GalleryController.scala +++ b/applications/app/controllers/GalleryController.scala @@ -7,6 +7,7 @@ import contentapi.ContentApiClient import model._ import model.dotcomrendering.{DotcomRenderingDataModel, PageType} import pages.GalleryHtmlPage +import play.api.libs.json.JsValue import play.api.libs.ws.WSClient import play.api.mvc._ import play.twirl.api.Html @@ -74,7 +75,7 @@ class GalleryController( private def getDCRJson(galleryPage: GalleryPage, pageType: PageType, blocks: Blocks)(implicit request: RequestHeader, - ): String = { + ): JsValue = { DotcomRenderingDataModel.toJson(DotcomRenderingDataModel.forGallery(galleryPage, request, pageType, blocks)) } diff --git a/applications/app/controllers/ImageContentController.scala b/applications/app/controllers/ImageContentController.scala index daa7310efcf..278104e2246 100644 --- a/applications/app/controllers/ImageContentController.scala +++ b/applications/app/controllers/ImageContentController.scala @@ -61,7 +61,7 @@ class ImageContentController( private def getDCRJson(content: ImageContentPage, pageType: PageType, mainBlock: Option[Block])(implicit request: RequestHeader, - ): String = { + ): JsValue = { DotcomRenderingDataModel.toJson(DotcomRenderingDataModel.forImageContent(content, request, pageType, mainBlock)) } diff --git a/applications/app/controllers/MediaController.scala b/applications/app/controllers/MediaController.scala index 6d455b3af78..2e096897844 100644 --- a/applications/app/controllers/MediaController.scala +++ b/applications/app/controllers/MediaController.scala @@ -9,7 +9,7 @@ import implicits.{AppsFormat, JsonFormat} import model._ import model.dotcomrendering.{DotcomRenderingDataModel, PageType} import pages.ContentHtmlPage -import play.api.libs.json.{Format, JsObject, Json} +import play.api.libs.json.{Format, JsObject, Json, JsValue} import play.api.libs.ws.WSClient import play.api.mvc._ import renderers.DotcomRenderingService @@ -96,7 +96,7 @@ class MediaController( private def getDCRJson(content: MediaPage, pageType: PageType, blocks: Blocks)(implicit request: RequestHeader, - ): String = { + ): JsValue = { DotcomRenderingDataModel.toJson(DotcomRenderingDataModel.forMedia(content, request, pageType, blocks)) } diff --git a/article/app/controllers/ArticleController.scala b/article/app/controllers/ArticleController.scala index 1ea08a3eb07..6ac328f5236 100644 --- a/article/app/controllers/ArticleController.scala +++ b/article/app/controllers/ArticleController.scala @@ -8,7 +8,7 @@ import model.Cached.{RevalidatableResult, WithoutRevalidationResult} import model.dotcomrendering.{DotcomRenderingDataModel, PageType} import model._ import pages.{ArticleEmailHtmlPage, ArticleHtmlPage} -import play.api.libs.json.Json +import play.api.libs.json.{Json, JsValue} import play.api.libs.ws.WSClient import play.api.mvc._ import renderers.DotcomRenderingService @@ -91,7 +91,7 @@ class ArticleController( /** Returns a JSON representation of the payload that's sent to DCR when rendering the Article. */ - private def getDCRJson(article: ArticlePage, blocks: Blocks)(implicit request: RequestHeader): String = { + private def getDCRJson(article: ArticlePage, blocks: Blocks)(implicit request: RequestHeader): JsValue = { val pageType: PageType = PageType(article, request, context) val newsletter = newsletterService.getNewsletterForArticle(article) diff --git a/common/app/common/package.scala b/common/app/common/package.scala index 51f51aeb434..dc4ea81434e 100644 --- a/common/app/common/package.scala +++ b/common/app/common/package.scala @@ -10,7 +10,7 @@ import model.CacheTime.RecentlyUpdated import model.Cached.RevalidatableResult import model.{ApplicationContext, Cached, NoCache} import play.api.Logger -import play.api.libs.json.{JsObject, JsString} +import play.api.libs.json.{JsObject, JsString, JsValue} import play.api.mvc.{RequestHeader, Result} import play.twirl.api.Html import model.ApplicationContext @@ -162,7 +162,10 @@ object `package` JsonComponent(page, json) } - def renderJson(json: String, page: model.Page)(implicit request: RequestHeader, context: ApplicationContext): Result = + def renderJson(json: JsValue, page: model.Page)(implicit + request: RequestHeader, + context: ApplicationContext, + ): Result = Cached(page) { RevalidatableResult.Ok(json) } diff --git a/common/app/model/dotcomrendering/DotcomBlocksRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomBlocksRenderingDataModel.scala index 6edc08e8aa5..edba663ef04 100644 --- a/common/app/model/dotcomrendering/DotcomBlocksRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomBlocksRenderingDataModel.scala @@ -58,9 +58,9 @@ object DotcomBlocksRenderingDataModel { } } - def toJson(model: DotcomBlocksRenderingDataModel): String = { + def toJson(model: DotcomBlocksRenderingDataModel): JsValue = { val jsValue = Json.toJson(model) - Json.stringify(DotcomRenderingUtils.withoutNull(jsValue)) + DotcomRenderingUtils.withoutNull(jsValue) } def apply( diff --git a/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala index dbec33a6051..d5fc57c7206 100644 --- a/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomFrontsRenderingDataModel.scala @@ -98,8 +98,8 @@ object DotcomFrontsRenderingDataModel { ) } - def toJson(model: DotcomFrontsRenderingDataModel): String = { + def toJson(model: DotcomFrontsRenderingDataModel): JsValue = { val jsValue = Json.toJson(model) - Json.stringify(DotcomRenderingUtils.withoutNull(jsValue)) + DotcomRenderingUtils.withoutNull(jsValue) } } diff --git a/common/app/model/dotcomrendering/DotcomNewslettersPageRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomNewslettersPageRenderingDataModel.scala index 0754e215907..46256ce4dda 100644 --- a/common/app/model/dotcomrendering/DotcomNewslettersPageRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomNewslettersPageRenderingDataModel.scala @@ -97,9 +97,9 @@ object DotcomNewslettersPageRenderingDataModel { ) } - def toJson(model: DotcomNewslettersPageRenderingDataModel): String = { + def toJson(model: DotcomNewslettersPageRenderingDataModel): JsValue = { val jsValue = Json.toJson(model) - Json.stringify(DotcomRenderingUtils.withoutNull(jsValue)) + DotcomRenderingUtils.withoutNull(jsValue) } private def convertNewsletterResponseToData(response: NewsletterResponseV2): NewsletterData = { diff --git a/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala index b8771ad55e7..cce1327fef4 100644 --- a/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala @@ -191,9 +191,9 @@ object DotcomRenderingDataModel { } } - def toJson(model: DotcomRenderingDataModel): String = { + def toJson(model: DotcomRenderingDataModel): JsValue = { val jsValue = Json.toJson(model) - Json.stringify(withoutNull(jsValue)) + withoutNull(jsValue) } def forInteractive( diff --git a/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala index 4a76a7bf976..2cf5dc72cf7 100644 --- a/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomTagPagesRenderingDataModel.scala @@ -132,8 +132,8 @@ object DotcomTagPagesRenderingDataModel { ) } - def toJson(model: DotcomTagPagesRenderingDataModel): String = { + def toJson(model: DotcomTagPagesRenderingDataModel): JsValue = { val jsValue = Json.toJson(model) - Json.stringify(DotcomRenderingUtils.withoutNull(jsValue)) + DotcomRenderingUtils.withoutNull(jsValue) } } diff --git a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala index 180e91803ac..3b6c92c1d83 100644 --- a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala @@ -2,9 +2,10 @@ package model.dotcomrendering.pageElements import com.gu.contentapi.client.model.v1.Crossword import com.gu.contentapi.json.CirceEncoders._ -import io.circe.JsonObject import io.circe.syntax._ import implicits.Dates.CapiRichDateTime +import model.dotcomrendering.DotcomRenderingUtils +import play.api.libs.json.{JsObject, Json, JsValue} case class EditionsCrosswordRenderingDataModel( crosswords: Iterable[Crossword], @@ -25,9 +26,10 @@ object EditionsCrosswordRenderingDataModel { } })) - def toJson(model: EditionsCrosswordRenderingDataModel): String = { - JsonObject( - "crosswords" -> model.crosswords.asJson.deepDropNullValues, - ).asJson.noSpaces - } + def toJson(model: EditionsCrosswordRenderingDataModel): JsValue = + DotcomRenderingUtils.withoutNull( + Json.obj( + "crosswords" -> Json.parse(model.crosswords.asJson.toString()), + ), + ) } diff --git a/common/app/renderers/DotcomRenderingService.scala b/common/app/renderers/DotcomRenderingService.scala index a02f30f4e33..0c00020732d 100644 --- a/common/app/renderers/DotcomRenderingService.scala +++ b/common/app/renderers/DotcomRenderingService.scala @@ -25,6 +25,7 @@ import model.{ RelatedContentItem, SimplePage, } +import play.api.libs.json.JsValue import play.api.libs.ws.{WSClient, WSResponse} import play.api.mvc.Results.{InternalServerError, NotFound} import play.api.mvc.{RequestHeader, Result} @@ -56,7 +57,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload private[this] def postWithoutHandler( ws: WSClient, - payload: String, + payload: JsValue, endpoint: String, timeout: Duration = Configuration.rendering.timeout, )(implicit request: RequestHeader): Future[WSResponse] = { @@ -93,7 +94,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload private[this] def post( ws: WSClient, - payload: String, + payload: JsValue, endpoint: String, cacheTime: CacheTime, timeout: Duration = Configuration.rendering.timeout, diff --git a/common/test/renderers/DotcomRenderingServiceTest.scala b/common/test/renderers/DotcomRenderingServiceTest.scala index 7e3d2f4477c..6f4fd2158cb 100644 --- a/common/test/renderers/DotcomRenderingServiceTest.scala +++ b/common/test/renderers/DotcomRenderingServiceTest.scala @@ -6,6 +6,7 @@ import org.scalatest.{BeforeAndAfterAll, DoNotDiscover, PrivateMethodTester} import org.scalatest.matchers.should.Matchers import test.{ConfiguredTestSuite, TestRequest, WithMaterializer, WithTestWsClient} import play.api.libs.ws.{WSClient, WSRequest, WSResponse} +import play.api.libs.json.{JsString} import play.api.mvc.{Result} import conf.Configuration import org.mockito.Matchers.any @@ -35,7 +36,7 @@ import org.scalatest.flatspec.AnyFlatSpec private val wsRequestMock = mock[WSRequest] "post" should "return a 404 for DCR 415 errors" in { - val payload = "payload" + val payload = JsString("payload") when(wsMock.url(any[String])).thenReturn(wsRequestMock) when(wsRequestMock.withRequestTimeout(any())).thenReturn(wsRequestMock) when(wsRequestMock.addHttpHeaders(any())).thenReturn(wsRequestMock) From 95dea826c1d671eadf925eb24ab641542b2cdf2c Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Fri, 13 Dec 2024 18:50:36 +0000 Subject: [PATCH 21/28] Use Circe's `deepDropNullValues` instead of `withoutNull` (#27673) `DotcomRenderingUtils.withoutNull` is not recursive, therefore nested `null` fields make it through to DCAR, causing validation errors. --- .../pageElements/EditionsCrosswordRenderingDataModel.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala index 3b6c92c1d83..189b9d0ee83 100644 --- a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala @@ -27,9 +27,7 @@ object EditionsCrosswordRenderingDataModel { })) def toJson(model: EditionsCrosswordRenderingDataModel): JsValue = - DotcomRenderingUtils.withoutNull( - Json.obj( - "crosswords" -> Json.parse(model.crosswords.asJson.toString()), - ), + Json.obj( + "crosswords" -> Json.parse(model.crosswords.asJson.deepDropNullValues.toString()), ) } From abd9095d5e1471e4a00bbc5c620a671cd58e8406 Mon Sep 17 00:00:00 2001 From: Dominik Lander Date: Mon, 16 Dec 2024 09:32:35 +0000 Subject: [PATCH 22/28] Add onwards content test to list of tests --- .../javascripts/projects/common/modules/experiments/ab-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts b/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts index 5ae6add8eea..4c412a859b1 100644 --- a/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts +++ b/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts @@ -1,4 +1,5 @@ import type { ABTest } from '@guardian/ab-core'; +import { onwardsContentArticle } from './tests/onwards-content-article'; import { remoteRRHeaderLinksTest } from './tests/remote-header-test'; import { signInGateMainControl } from './tests/sign-in-gate-main-control'; import { signInGateMainVariant } from './tests/sign-in-gate-main-variant'; @@ -11,4 +12,5 @@ export const concurrentTests: readonly ABTest[] = [ signInGateMainControl, remoteRRHeaderLinksTest, UsaExpandableMarketingCard, + onwardsContentArticle, ]; From e58d5bc55e64a99e73f78ccd332636537696ed90 Mon Sep 17 00:00:00 2001 From: Demetrios Skamiotis Date: Tue, 17 Dec 2024 15:10:13 +0000 Subject: [PATCH 23/28] extend gpid-prebid test to mid January --- common/app/conf/switches/ABTestSwitches.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/app/conf/switches/ABTestSwitches.scala b/common/app/conf/switches/ABTestSwitches.scala index 3f1c921eb30..7014dd20134 100644 --- a/common/app/conf/switches/ABTestSwitches.scala +++ b/common/app/conf/switches/ABTestSwitches.scala @@ -77,7 +77,7 @@ trait ABTestSwitches { "Test new GPID prebid ad units", owners = Seq(Owner.withEmail("commercial.dev@theguardian.com")), safeState = Off, - sellByDate = Some(LocalDate.of(2024, 12, 18)), + sellByDate = Some(LocalDate.of(2025, 1, 17)), exposeClientSide = true, highImpact = false, ) From eca08f601cec45e30b0071789f1b8043b03a052a Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Wed, 18 Dec 2024 11:08:44 +0000 Subject: [PATCH 24/28] Add test for prebid region split --- common/app/conf/switches/ABTestSwitches.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/app/conf/switches/ABTestSwitches.scala b/common/app/conf/switches/ABTestSwitches.scala index 7014dd20134..a2d76c47826 100644 --- a/common/app/conf/switches/ABTestSwitches.scala +++ b/common/app/conf/switches/ABTestSwitches.scala @@ -81,4 +81,15 @@ trait ABTestSwitches { exposeClientSide = true, highImpact = false, ) + + Switch( + ABTests, + "ab-region-specific-prebid", + "Test impact of splitting the Prebid bundle by region", + owners = Seq(Owner.withEmail("commercial.dev@theguardian.com")), + safeState = Off, + sellByDate = Some(LocalDate.of(2025, 1, 24)), + exposeClientSide = true, + highImpact = false, + ) } From e792c0579634c3eab08a11c56462bcb7e90d859e Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Wed, 18 Dec 2024 11:08:54 +0000 Subject: [PATCH 25/28] Bump commercial --- package.json | 2 +- yarn.lock | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index a62588727c1..347feaa3303 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@emotion/react": "11.11.1", "@emotion/styled": "^10.0.27", "@guardian/ab-core": "8.0.0", - "@guardian/commercial": "23.7.5", + "@guardian/commercial": "23.8.0", "@guardian/core-web-vitals": "6.0.0", "@guardian/eslint-config-typescript": "9.0.1", "@guardian/identity-auth": "3.0.0", diff --git a/yarn.lock b/yarn.lock index 0ded5847fca..09f5268e55e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3607,11 +3607,11 @@ __metadata: languageName: node linkType: hard -"@guardian/commercial@npm:23.7.5": - version: 23.7.5 - resolution: "@guardian/commercial@npm:23.7.5" +"@guardian/commercial@npm:23.8.0": + version: 23.8.0 + resolution: "@guardian/commercial@npm:23.8.0" dependencies: - "@guardian/prebid.js": "npm:8.52.0-8" + "@guardian/prebid.js": "npm:8.52.0-10" "@octokit/core": "npm:^6.1.2" fastdom: "npm:^1.0.11" lodash-es: "npm:^4.17.21" @@ -3626,7 +3626,7 @@ __metadata: "@guardian/libs": ^19.1.0 "@guardian/source": ^8.0.0 typescript: ~5.5.3 - checksum: 10c0/1f6dddf3b6539d0c7d275804e0429fa2dd4b301e162131c2b0a112f5b8dd4b37770343c916dfd57bb2c77570a5c730d5fd66dcc6d30d893386665fcb7b2423a9 + checksum: 10c0/b5b0d5520561c383af135f1db98f8102fa5ee39c5a9ac630b86aaa2dd83c7808c183a369418a6e1ba48e51c1960c54c35fdac2a5aff3b5cfb633187f079e1232 languageName: node linkType: hard @@ -3699,7 +3699,7 @@ __metadata: "@emotion/react": "npm:11.11.1" "@emotion/styled": "npm:^10.0.27" "@guardian/ab-core": "npm:8.0.0" - "@guardian/commercial": "npm:23.7.5" + "@guardian/commercial": "npm:23.8.0" "@guardian/core-web-vitals": "npm:6.0.0" "@guardian/eslint-config-typescript": "npm:9.0.1" "@guardian/identity-auth": "npm:3.0.0" @@ -3887,9 +3887,9 @@ __metadata: languageName: node linkType: hard -"@guardian/prebid.js@npm:8.52.0-8": - version: 8.52.0-8 - resolution: "@guardian/prebid.js@npm:8.52.0-8" +"@guardian/prebid.js@npm:8.52.0-10": + version: 8.52.0-10 + resolution: "@guardian/prebid.js@npm:8.52.0-10" dependencies: "@babel/core": "npm:^7.23.2" "@babel/plugin-transform-runtime": "npm:^7.18.9" @@ -3912,7 +3912,7 @@ __metadata: dependenciesMeta: fsevents: optional: true - checksum: 10c0/14f8afbc90f6738999898184b698611296e3d657c74a2467d9045b0129a582b9e7b4670343609f6645e69003504d80587b0d2e1c982ecc45d53a626eb2532260 + checksum: 10c0/10076e408bf7b867cdd39819231e3716d3b3f77d1bb2d3528a321755ab542a68742f8a2af15af482df50a8c78b955d022f7e903be71378a245ef2dc092a60b34 languageName: node linkType: hard From 2eb9bab6bb794e7d9a6652d57f80f62f59499098 Mon Sep 17 00:00:00 2001 From: Daniel Clifton <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:30:09 +0000 Subject: [PATCH 26/28] Don't log to stdout in dev (#27677) * Don't log to stdout in dev * Add stage to sbt bash script Co-authored-by: Andrew Nowak <10963046+andrew-nowak@users.noreply.github.com> --- admin/conf/logback.xml | 8 +++++++- applications/conf/logback.xml | 8 +++++++- archive/conf/logback.xml | 8 +++++++- article/conf/logback.xml | 8 +++++++- build.sbt | 1 + commercial/conf/logback.xml | 8 +++++++- common/test/resources/logback.xml | 8 +++++++- dev-build/conf/logback.xml | 8 +++++++- discussion/conf/logback.xml | 8 +++++++- facia-press/conf/logback.xml | 8 +++++++- facia/conf/logback.xml | 8 +++++++- identity/conf/logback.xml | 8 +++++++- onward/conf/logback.xml | 8 +++++++- preview/conf/logback.xml | 8 +++++++- project/Dependencies.scala | 1 + rss/conf/logback.xml | 8 +++++++- sbt | 1 + sport/conf/logback.xml | 8 +++++++- 18 files changed, 108 insertions(+), 15 deletions(-) diff --git a/admin/conf/logback.xml b/admin/conf/logback.xml index 45418df2aa3..ce08bf16805 100644 --- a/admin/conf/logback.xml +++ b/admin/conf/logback.xml @@ -30,7 +30,13 @@ - + + + + + + + diff --git a/applications/conf/logback.xml b/applications/conf/logback.xml index 73674b3d957..2631c29502f 100644 --- a/applications/conf/logback.xml +++ b/applications/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/archive/conf/logback.xml b/archive/conf/logback.xml index 34e52a43877..f8569dd5e11 100644 --- a/archive/conf/logback.xml +++ b/archive/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/article/conf/logback.xml b/article/conf/logback.xml index befc7af7839..d97caedccc1 100644 --- a/article/conf/logback.xml +++ b/article/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/build.sbt b/build.sbt index afc1bac4d01..fea5bd9fe35 100644 --- a/build.sbt +++ b/build.sbt @@ -70,6 +70,7 @@ val common = library("common") pekkoSlf4j, pekkoSerializationJackson, pekkoActorTyped, + janino, ) ++ jackson, TestAssets / mappings ~= filterAssets, ) diff --git a/commercial/conf/logback.xml b/commercial/conf/logback.xml index 044b5cfe355..63dfc3ec7e7 100644 --- a/commercial/conf/logback.xml +++ b/commercial/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/common/test/resources/logback.xml b/common/test/resources/logback.xml index 03c2e50630e..2c8848d0524 100644 --- a/common/test/resources/logback.xml +++ b/common/test/resources/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/dev-build/conf/logback.xml b/dev-build/conf/logback.xml index 34fad145436..cb86de9b9c3 100644 --- a/dev-build/conf/logback.xml +++ b/dev-build/conf/logback.xml @@ -29,7 +29,13 @@ - + + + + + + + diff --git a/discussion/conf/logback.xml b/discussion/conf/logback.xml index f22cc96f287..627925dab0a 100644 --- a/discussion/conf/logback.xml +++ b/discussion/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/facia-press/conf/logback.xml b/facia-press/conf/logback.xml index 19e1eadccec..10d19e00304 100644 --- a/facia-press/conf/logback.xml +++ b/facia-press/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/facia/conf/logback.xml b/facia/conf/logback.xml index 213c4378414..07d73510602 100644 --- a/facia/conf/logback.xml +++ b/facia/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/identity/conf/logback.xml b/identity/conf/logback.xml index 35795d61ae6..937dec8f9b9 100644 --- a/identity/conf/logback.xml +++ b/identity/conf/logback.xml @@ -29,6 +29,12 @@ - + + + + + + + diff --git a/onward/conf/logback.xml b/onward/conf/logback.xml index 95974d06e78..80bfbd32b7e 100644 --- a/onward/conf/logback.xml +++ b/onward/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/preview/conf/logback.xml b/preview/conf/logback.xml index ce692fbc7dd..acf14222289 100644 --- a/preview/conf/logback.xml +++ b/preview/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 8283800dfaf..4e085fd83f2 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -88,6 +88,7 @@ object Dependencies { val logstash = ("net.logstash.logback" % "logstash-logback-encoder" % "8.0") .excludeAll(ExclusionRule("com.fasterxml.jackson.core")) // Avoid conflicts with Play's Jackson dependency + val janino = "org.codehaus.janino" % "janino" % "3.1.12" val targetingClient = "com.gu.targeting-client" %% "client-play-json-v30" % "1.1.9" val scanamo = "org.scanamo" %% "scanamo" % "2.0.0" diff --git a/rss/conf/logback.xml b/rss/conf/logback.xml index 223af294c62..2435e9168ca 100644 --- a/rss/conf/logback.xml +++ b/rss/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + diff --git a/sbt b/sbt index 6dc1c59a539..fc9cbbfa7ea 100755 --- a/sbt +++ b/sbt @@ -59,4 +59,5 @@ export APP_SECRET="this_is_not_a_real_secret_just_for_tests" java $FRONTEND_JVM_ARGS \ $DEBUG_PARAMS \ -Duser.timezone=Australia/Sydney \ + -DSTAGE=DEV \ -jar `dirname $0`/bin/sbt-launch.jar "$@" diff --git a/sport/conf/logback.xml b/sport/conf/logback.xml index 90bcb69fdf0..d1b9a048be1 100644 --- a/sport/conf/logback.xml +++ b/sport/conf/logback.xml @@ -25,7 +25,13 @@ - + + + + + + + From a3726fd79f392a49d7535c3d4fcd079a993d27d0 Mon Sep 17 00:00:00 2001 From: Jake Date: Thu, 19 Dec 2024 11:37:16 +0000 Subject: [PATCH 27/28] Delete old header bidding endpoint (#27678) --- .../controllers/CommercialControllers.scala | 1 - .../PrebidAnalyticsController.scala | 18 ------------------ commercial/conf/routes | 3 --- common/app/common/configuration.scala | 2 -- common/app/http/RequestLoggingFilter.scala | 4 ++-- dev-build/conf/routes | 1 - 6 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 commercial/app/controllers/PrebidAnalyticsController.scala diff --git a/commercial/app/controllers/CommercialControllers.scala b/commercial/app/controllers/CommercialControllers.scala index 3dc6767bde6..9533b212e3f 100644 --- a/commercial/app/controllers/CommercialControllers.scala +++ b/commercial/app/controllers/CommercialControllers.scala @@ -25,7 +25,6 @@ trait CommercialControllers { lazy val piggybackPixelController = wire[PiggybackPixelController] lazy val cmpDataController = wire[CmpDataController] lazy val adsDotTextFileController = wire[AdsDotTextViewController] - lazy val prebidAnalyticsController = wire[PrebidAnalyticsController] lazy val passbackController = wire[PassbackController] lazy val ampIframeHtmlController = wire[AmpIframeHtmlController] lazy val nonRefreshableLineItemsController = wire[nonRefreshableLineItemsController] diff --git a/commercial/app/controllers/PrebidAnalyticsController.scala b/commercial/app/controllers/PrebidAnalyticsController.scala deleted file mode 100644 index 788511f6701..00000000000 --- a/commercial/app/controllers/PrebidAnalyticsController.scala +++ /dev/null @@ -1,18 +0,0 @@ -package commercial.controllers - -import common.GuLogging -import conf.Configuration.commercial.prebidAnalyticsStream -import conf.switches.Switches -import play.api.mvc._ - -import scala.concurrent.ExecutionContext - -class PrebidAnalyticsController(val controllerComponents: ControllerComponents) extends BaseController with GuLogging { - - private implicit val ec: ExecutionContext = controllerComponents.executionContext - - def insert(): Action[String] = - Action(parse.text) { implicit request => - Analytics.storeJsonBody(Switches.prebidAnalytics, prebidAnalyticsStream, log)(request.body) - } -} diff --git a/commercial/conf/routes b/commercial/conf/routes index 39858ed971d..f84e2e8c647 100644 --- a/commercial/conf/routes +++ b/commercial/conf/routes @@ -41,9 +41,6 @@ GET /commercial/cmp/shortvendorlist.json GET /ads.txt commercial.controllers.AdsDotTextViewController.renderTextFile() GET /app-ads.txt commercial.controllers.AdsDotTextViewController.renderAppTextFile() -# Analytics -POST /commercial/api/hb commercial.controllers.PrebidAnalyticsController.insert() - # Passbacks GET /commercial/ias-passback/:size commercial.controllers.PassbackController.renderIasPassback(size) diff --git a/common/app/common/configuration.scala b/common/app/common/configuration.scala index 59d8e7f32ce..93f1f98a064 100644 --- a/common/app/common/configuration.scala +++ b/common/app/common/configuration.scala @@ -515,8 +515,6 @@ class GuardianConfiguration extends GuLogging { lazy val expiredPaidContentUrl = s"${site.host}/info/2015/feb/06/paid-content-removal-policy" - lazy val prebidAnalyticsStream = configuration.getMandatoryStringProperty("commercial.prebid.analytics.stream") - lazy val prebidServerUrl = configuration.getStringProperty("commercial.prebid.server.url") getOrElse "http://localhost:8000" diff --git a/common/app/http/RequestLoggingFilter.scala b/common/app/http/RequestLoggingFilter.scala index e2e95a3732b..c66e9454d55 100644 --- a/common/app/http/RequestLoggingFilter.scala +++ b/common/app/http/RequestLoggingFilter.scala @@ -29,8 +29,8 @@ class RequestLoggingFilter(implicit val mat: Materializer, executionContext: Exe case _ => "" } } - // don't log uncacheable /commercial/api/hb POST requests due to the volume of them - if (rh.method != "POST" || rh.path != "/commercial/api/hb") { + // don't log uncacheable POST requests due to the volume of them + if (rh.method != "POST") { requestLogger.withResponse(response).info(s"${rh.method} ${rh.uri}$additionalInfo") } case Failure(error) => diff --git a/dev-build/conf/routes b/dev-build/conf/routes index 8329b037133..8e33f238fb3 100644 --- a/dev-build/conf/routes +++ b/dev-build/conf/routes @@ -279,7 +279,6 @@ GET /commercial/non-refreshable-line-items.json GET /ads.txt commercial.controllers.AdsDotTextViewController.renderTextFile() GET /app-ads.txt commercial.controllers.AdsDotTextViewController.renderAppTextFile() GET /commercial/ias-passback/:size commercial.controllers.PassbackController.renderIasPassback(size) -POST /commercial/api/hb commercial.controllers.PrebidAnalyticsController.insert() # Commercial Admin GET /commercial controllers.admin.CommercialController.renderCommercialMenu() From 12248413bcb4a3bace7993186611054c4682c541 Mon Sep 17 00:00:00 2001 From: David Furey Date: Thu, 19 Dec 2024 15:27:33 +0000 Subject: [PATCH 28/28] Bump content api client This should fix an issue that we've seen with content that does not have main media failing to render --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 4e085fd83f2..55f1dc7dc03 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -6,7 +6,7 @@ object Dependencies { val identityLibVersion = "4.31" val awsVersion = "1.12.758" val awsSdk2Version = "2.26.27" - val capiVersion = "32.0.0" + val capiVersion = "32.0.1" val faciaVersion = "13.1.0" val dispatchVersion = "0.13.1" val romeVersion = "1.0"