From 05c5a712e3c29b88f898b4d99ddf3fdadceda0e5 Mon Sep 17 00:00:00 2001 From: Ioanna Kokkini Date: Wed, 22 May 2024 13:11:22 +0100 Subject: [PATCH 1/8] Add europe and international in the high frequency paths These fronts are pressed every 2 minutes in CODE and every 1 minute in PROD. These regular presses are triggered by a cron job running in the admin app and can have high, standard or low frequency. Editions and sports fronts have a high update frequency. The job is important because content for a front can be coming from CAPI and change without any update from the Fronts tool, e.g. a snap link. See more about the fronts architecutre here: https://github.com/guardian/frontend/blob/main/docs/02-architecture/02-fronts-architecture.md --- admin/app/jobs/RefreshFrontsJob.scala | 2 +- facia-press/app/frontpress/FrontPressCron.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/app/jobs/RefreshFrontsJob.scala b/admin/app/jobs/RefreshFrontsJob.scala index d3d7e5217e1..4c5673929e8 100644 --- a/admin/app/jobs/RefreshFrontsJob.scala +++ b/admin/app/jobs/RefreshFrontsJob.scala @@ -13,7 +13,7 @@ object LowFrequency extends FrontType object StandardFrequency extends FrontType object HighFrequency extends FrontType { def highFrequencyPaths: List[String] = - List("uk", "us", "au", "uk/sport", "us/sport", "au/sport") + List("uk", "us", "au", "europe", "international", "uk/sport", "us/sport", "au/sport") } case class CronUpdate(path: String, frontType: FrontType) diff --git a/facia-press/app/frontpress/FrontPressCron.scala b/facia-press/app/frontpress/FrontPressCron.scala index 12e2f9f9448..702ab79c7d8 100644 --- a/facia-press/app/frontpress/FrontPressCron.scala +++ b/facia-press/app/frontpress/FrontPressCron.scala @@ -10,7 +10,7 @@ import services.ConfigAgent import scala.concurrent.{ExecutionContext, Future} -class FrontPressCron(liveFapiFrontPress: LiveFapiFrontPress, toolPressQueueWorker: ToolPressQueueWorker)(implicit +class FrontPressCron(liveFapiFrontPress: LiveFapiFrontPress)(implicit executionContext: ExecutionContext, ) extends JsonQueueWorker[SNSNotification] { override val deleteOnFailure: Boolean = true From 10c5d61737379a2fb3f67e1d677b6ac68bad33bc Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Fri, 24 May 2024 11:50:25 +0100 Subject: [PATCH 2/8] Upgrade dfp-axis to 5.5.0 --- admin/app/dfp/AdUnitAgent.scala | 2 +- admin/app/dfp/ApiHelper.scala | 2 +- admin/app/dfp/CustomFieldAgent.scala | 4 ++-- admin/app/dfp/CustomTargetingAgent.scala | 4 ++-- admin/app/dfp/DataMapper.scala | 2 +- admin/app/dfp/DataValidation.scala | 2 +- admin/app/dfp/DfpApi.scala | 4 ++-- admin/app/dfp/PlacementAgent.scala | 2 +- admin/app/dfp/Reader.scala | 6 +++--- admin/app/dfp/ServicesWrapper.scala | 2 +- admin/app/dfp/SessionLogger.scala | 4 ++-- admin/app/dfp/SessionWrapper.scala | 4 ++-- admin/app/jobs/CommercialDfpReporting.scala | 8 ++++---- admin/test/dfp/DfpApiValidationTest.scala | 2 +- admin/test/dfp/ReaderTest.scala | 2 +- project/Dependencies.scala | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/admin/app/dfp/AdUnitAgent.scala b/admin/app/dfp/AdUnitAgent.scala index 5c03ad3eb97..956bd070bbf 100644 --- a/admin/app/dfp/AdUnitAgent.scala +++ b/admin/app/dfp/AdUnitAgent.scala @@ -1,6 +1,6 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder import common.dfp.GuAdUnit import conf.Configuration import ApiHelper.toSeq diff --git a/admin/app/dfp/ApiHelper.scala b/admin/app/dfp/ApiHelper.scala index 3ea51b05999..5268ce68970 100644 --- a/admin/app/dfp/ApiHelper.scala +++ b/admin/app/dfp/ApiHelper.scala @@ -1,6 +1,6 @@ package dfp -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.v202405._ import common.GuLogging import org.joda.time.{DateTime => JodaDateTime, DateTimeZone} diff --git a/admin/app/dfp/CustomFieldAgent.scala b/admin/app/dfp/CustomFieldAgent.scala index 25d6b5bcfe9..de35cbe0e6c 100644 --- a/admin/app/dfp/CustomFieldAgent.scala +++ b/admin/app/dfp/CustomFieldAgent.scala @@ -1,7 +1,7 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder -import com.google.api.ads.admanager.axis.v202308.{CustomFieldValue, LineItem, TextValue} +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder +import com.google.api.ads.admanager.axis.v202405.{CustomFieldValue, LineItem, TextValue} import common.dfp.GuCustomField import concurrent.BlockingOperations diff --git a/admin/app/dfp/CustomTargetingAgent.scala b/admin/app/dfp/CustomTargetingAgent.scala index 8aef11b4387..620bec28bdc 100644 --- a/admin/app/dfp/CustomTargetingAgent.scala +++ b/admin/app/dfp/CustomTargetingAgent.scala @@ -1,7 +1,7 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder -import com.google.api.ads.admanager.axis.v202308.{CustomTargetingKey, CustomTargetingValue} +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder +import com.google.api.ads.admanager.axis.v202405.{CustomTargetingKey, CustomTargetingValue} import common.GuLogging import common.dfp.{GuCustomTargeting, GuCustomTargetingValue} import concurrent.BlockingOperations diff --git a/admin/app/dfp/DataMapper.scala b/admin/app/dfp/DataMapper.scala index e788606ad1a..1e845f3d2ad 100644 --- a/admin/app/dfp/DataMapper.scala +++ b/admin/app/dfp/DataMapper.scala @@ -1,6 +1,6 @@ package dfp -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.v202405._ import common.dfp._ import dfp.ApiHelper.{isPageSkin, optJavaInt, toJodaTime, toSeq} diff --git a/admin/app/dfp/DataValidation.scala b/admin/app/dfp/DataValidation.scala index 1dcffea99f6..31418bc2903 100644 --- a/admin/app/dfp/DataValidation.scala +++ b/admin/app/dfp/DataValidation.scala @@ -1,6 +1,6 @@ package dfp -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.v202405._ import common.dfp._ import dfp.ApiHelper.toSeq diff --git a/admin/app/dfp/DfpApi.scala b/admin/app/dfp/DfpApi.scala index 926658cd3bf..c3b9b15fb86 100644 --- a/admin/app/dfp/DfpApi.scala +++ b/admin/app/dfp/DfpApi.scala @@ -2,8 +2,8 @@ package dfp // StatementBuilder query language is PQL defined here: // https://developers.google.com/ad-manager/api/pqlreference -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder +import com.google.api.ads.admanager.axis.v202405._ import com.madgag.scala.collection.decorators.MapDecorator import common.GuLogging import common.dfp._ diff --git a/admin/app/dfp/PlacementAgent.scala b/admin/app/dfp/PlacementAgent.scala index 0681abc7294..7764346b339 100644 --- a/admin/app/dfp/PlacementAgent.scala +++ b/admin/app/dfp/PlacementAgent.scala @@ -1,6 +1,6 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder import common.dfp.GuAdUnit import concurrent.BlockingOperations diff --git a/admin/app/dfp/Reader.scala b/admin/app/dfp/Reader.scala index 141fc2b9c4a..522b03a67ce 100644 --- a/admin/app/dfp/Reader.scala +++ b/admin/app/dfp/Reader.scala @@ -1,8 +1,8 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder.SUGGESTED_PAGE_LIMIT -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder.SUGGESTED_PAGE_LIMIT +import com.google.api.ads.admanager.axis.v202405._ import scala.annotation.tailrec diff --git a/admin/app/dfp/ServicesWrapper.scala b/admin/app/dfp/ServicesWrapper.scala index 8bc1dd004eb..371a3812fd9 100644 --- a/admin/app/dfp/ServicesWrapper.scala +++ b/admin/app/dfp/ServicesWrapper.scala @@ -1,7 +1,7 @@ package dfp import com.google.api.ads.admanager.axis.factory.AdManagerServices -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.v202405._ import com.google.api.ads.admanager.lib.client.AdManagerSession private[dfp] class ServicesWrapper(session: AdManagerSession) { diff --git a/admin/app/dfp/SessionLogger.scala b/admin/app/dfp/SessionLogger.scala index 8a4419aa78d..05e86958204 100644 --- a/admin/app/dfp/SessionLogger.scala +++ b/admin/app/dfp/SessionLogger.scala @@ -1,7 +1,7 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder +import com.google.api.ads.admanager.axis.v202405._ import common.GuLogging import scala.util.control.NonFatal diff --git a/admin/app/dfp/SessionWrapper.scala b/admin/app/dfp/SessionWrapper.scala index b3f95a883ef..a09c4618830 100644 --- a/admin/app/dfp/SessionWrapper.scala +++ b/admin/app/dfp/SessionWrapper.scala @@ -2,8 +2,8 @@ package dfp import com.google.api.ads.common.lib.auth.OfflineCredentials import com.google.api.ads.common.lib.auth.OfflineCredentials.Api -import com.google.api.ads.admanager.axis.utils.v202308.{ReportDownloader, StatementBuilder} -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.utils.v202405.{ReportDownloader, StatementBuilder} +import com.google.api.ads.admanager.axis.v202405._ import com.google.api.ads.admanager.lib.client.AdManagerSession import com.google.common.io.CharSource import common.GuLogging diff --git a/admin/app/jobs/CommercialDfpReporting.scala b/admin/app/jobs/CommercialDfpReporting.scala index dd62003f14d..11a26f08510 100644 --- a/admin/app/jobs/CommercialDfpReporting.scala +++ b/admin/app/jobs/CommercialDfpReporting.scala @@ -3,10 +3,10 @@ package jobs import java.time.{LocalDate, LocalDateTime} import app.LifecycleComponent -import com.google.api.ads.admanager.axis.v202308.Column.{AD_SERVER_IMPRESSIONS, AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM} -import com.google.api.ads.admanager.axis.v202308.DateRangeType.CUSTOM_DATE -import com.google.api.ads.admanager.axis.v202308.Dimension.{CUSTOM_CRITERIA, DATE} -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.v202405.Column.{AD_SERVER_IMPRESSIONS, AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM} +import com.google.api.ads.admanager.axis.v202405.DateRangeType.CUSTOM_DATE +import com.google.api.ads.admanager.axis.v202405.Dimension.{CUSTOM_CRITERIA, DATE} +import com.google.api.ads.admanager.axis.v202405._ import common.{PekkoAsync, Box, JobScheduler, GuLogging} import dfp.DfpApi import play.api.inject.ApplicationLifecycle diff --git a/admin/test/dfp/DfpApiValidationTest.scala b/admin/test/dfp/DfpApiValidationTest.scala index a739aba52b5..6f439265b1e 100644 --- a/admin/test/dfp/DfpApiValidationTest.scala +++ b/admin/test/dfp/DfpApiValidationTest.scala @@ -2,7 +2,7 @@ package dfp import concurrent.BlockingOperations import common.dfp.{GuAdUnit, GuLineItem, GuTargeting, Sponsorship} -import com.google.api.ads.admanager.axis.v202308._ +import com.google.api.ads.admanager.axis.v202405._ import org.joda.time.DateTime import org.apache.pekko.actor.ActorSystem import org.scalatest.flatspec.AnyFlatSpec diff --git a/admin/test/dfp/ReaderTest.scala b/admin/test/dfp/ReaderTest.scala index 7fdb0d4a908..80068ee030f 100644 --- a/admin/test/dfp/ReaderTest.scala +++ b/admin/test/dfp/ReaderTest.scala @@ -1,6 +1,6 @@ package dfp -import com.google.api.ads.admanager.axis.utils.v202308.StatementBuilder +import com.google.api.ads.admanager.axis.utils.v202405.StatementBuilder import dfp.Reader.read import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 759f27dd12e..5315fdca0eb 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -31,7 +31,7 @@ object Dependencies { val commonsIo = "commons-io" % "commons-io" % "2.16.1" val cssParser = "net.sourceforge.cssparser" % "cssparser" % "0.9.30" val contentApiClient = "com.gu" %% "content-api-client" % capiVersion - val dfpAxis = "com.google.api-ads" % "dfp-axis" % "5.4.0" + val dfpAxis = "com.google.api-ads" % "dfp-axis" % "5.5.0" val faciaFapiScalaClient = "com.gu" %% "fapi-client-play30" % faciaVersion val identityCookie = "com.gu.identity" %% "identity-cookie" % identityLibVersion From 2d19235657a3ceefc5d440c858e94eb4d73532b9 Mon Sep 17 00:00:00 2001 From: Dina Hafez Date: Tue, 28 May 2024 09:58:01 +0100 Subject: [PATCH 3/8] Remove 0% test --- common/app/experiments/Experiments.scala | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/common/app/experiments/Experiments.scala b/common/app/experiments/Experiments.scala index 15b6e8e0d6d..1ccb74ce1b1 100644 --- a/common/app/experiments/Experiments.scala +++ b/common/app/experiments/Experiments.scala @@ -14,7 +14,6 @@ object ActiveExperiments extends ExperimentsDefinition { DarkModeWeb, DCRTagPages, UpdatedHeaderDesign, - UpdateLogoAdPartner, MastheadWithHighlights, TagLinkDesign, ) @@ -49,15 +48,6 @@ object DarkModeWeb participationGroup = Perc0D, ) -object UpdateLogoAdPartner - extends Experiment( - name = "update-logo-ad-partner", - description = "Update logo for advertising partner and exclusive advertising partner US", - owners = Seq(Owner.withGithub("commercial.dev@theguardian.com")), - sellByDate = LocalDate.of(2024, 7, 30), - participationGroup = Perc0A, - ) - object DCRTagPages extends Experiment( name = "dcr-tag-pages", From 3e6df12786cc7423f63e2ae96a8f1ac6409a6b83 Mon Sep 17 00:00:00 2001 From: Dina Hafez Date: Tue, 28 May 2024 10:08:23 +0100 Subject: [PATCH 4/8] Add a switch for updated logo styling for advertising partner --- common/app/conf/switches/CommercialSwitches.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/app/conf/switches/CommercialSwitches.scala b/common/app/conf/switches/CommercialSwitches.scala index 067984c6185..140ca350c72 100644 --- a/common/app/conf/switches/CommercialSwitches.scala +++ b/common/app/conf/switches/CommercialSwitches.scala @@ -159,6 +159,17 @@ trait CommercialSwitches { sellByDate = never, exposeClientSide = true, ) + + val updateLogoAdPartner: Switch = Switch( + group = Commercial, + name = "update-logo-ad-partner", + description = + "Enable the updated logo styling for advertising partner and exclusive advertising partner US labels.", + owners = group(Commercial), + safeState = Off, + sellByDate = never, + exposeClientSide = true, + ) } trait PrebidSwitches { From 5052a929c98e0b48b36a8367118d489174c0bcd6 Mon Sep 17 00:00:00 2001 From: Dina Hafez Date: Tue, 28 May 2024 13:05:15 +0100 Subject: [PATCH 5/8] Add a sell by date as a reminder to delete it --- common/app/conf/switches/CommercialSwitches.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/app/conf/switches/CommercialSwitches.scala b/common/app/conf/switches/CommercialSwitches.scala index 140ca350c72..8f34b2782df 100644 --- a/common/app/conf/switches/CommercialSwitches.scala +++ b/common/app/conf/switches/CommercialSwitches.scala @@ -167,7 +167,7 @@ trait CommercialSwitches { "Enable the updated logo styling for advertising partner and exclusive advertising partner US labels.", owners = group(Commercial), safeState = Off, - sellByDate = never, + sellByDate = LocalDate.of(2024, 7, 31), exposeClientSide = true, ) } From d29062c88c5426501edc1d5e9a00a05ded4e59a7 Mon Sep 17 00:00:00 2001 From: Max Duval Date: Thu, 30 May 2024 08:46:50 +0100 Subject: [PATCH 6/8] Supported DCR tag pages for all (#27185) --- applications/app/services/TagPagePicker.scala | 17 +++++------ .../test/AllIndexControllerTest.scala | 4 ++- applications/test/IndexControllerTest.scala | 6 ++-- applications/test/IndexMetaDataTest.scala | 12 ++++---- applications/test/SectionTemplateTest.scala | 29 ++++++++++--------- applications/test/TagFeatureTest.scala | 10 +++---- applications/test/TagTemplateTest.scala | 2 +- .../app/conf/switches/FeatureSwitches.scala | 10 +++++++ common/app/experiments/Experiments.scala | 10 ------- facia/test/FaciaMetaDataTest.scala | 4 +-- 10 files changed, 53 insertions(+), 51 deletions(-) diff --git a/applications/app/services/TagPagePicker.scala b/applications/app/services/TagPagePicker.scala index 6d3c4db9099..9da234f40b1 100644 --- a/applications/app/services/TagPagePicker.scala +++ b/applications/app/services/TagPagePicker.scala @@ -1,7 +1,7 @@ package services.dotcomrendering import common.GuLogging -import experiments.{ActiveExperiments, DCRTagPages} +import conf.switches.Switches.DCRTagPages import implicits.Requests._ import model.TagCombiner import play.api.mvc.RequestHeader @@ -10,7 +10,7 @@ import services.IndexPage object TagPagePicker extends GuLogging { def getTier(tagPage: IndexPage)(implicit request: RequestHeader): RenderType = { - lazy val participatingInTest = ActiveExperiments.isParticipating(DCRTagPages) + lazy val isSwitchedOn = DCRTagPages.isSwitchedOn; val checks = dcrChecks(tagPage) @@ -19,11 +19,11 @@ object TagPagePicker extends GuLogging { request.isJson, request.forceDCROff, request.forceDCR, - participatingInTest, + isSwitchedOn, dcrCouldRender(checks), ) - logTier(tagPage, participatingInTest, dcrCouldRender(checks), checks, tier) + logTier(tagPage, isSwitchedOn, dcrCouldRender(checks), checks, tier) tier } @@ -45,7 +45,7 @@ object TagPagePicker extends GuLogging { isJson: Boolean, forceDCROff: Boolean, forceDCR: Boolean, - participatingInTest: Boolean, + isSwitchedOn: Boolean, dcrCouldRender: Boolean, ): RenderType = { if (isRss) LocalRender @@ -55,13 +55,13 @@ object TagPagePicker extends GuLogging { else LocalRender } else if (forceDCROff) LocalRender else if (forceDCR) RemoteRender - else if (dcrCouldRender && participatingInTest) RemoteRender + else if (dcrCouldRender && isSwitchedOn) RemoteRender else LocalRender } private def logTier( tagPage: IndexPage, - participatingInTest: Boolean, + isSwitchedOn: Boolean, dcrCouldRender: Boolean, checks: Map[String, Boolean], tier: RenderType, @@ -73,8 +73,7 @@ object TagPagePicker extends GuLogging { } val properties = Map( - "participatingInTest" -> participatingInTest.toString, - "testPercentage" -> DCRTagPages.participationGroup.percentage, + "isSwitchedOn" -> isSwitchedOn.toString, "dcrCouldRender" -> dcrCouldRender.toString, "isTagPage" -> "true", "tier" -> tierReadable, diff --git a/applications/test/AllIndexControllerTest.scala b/applications/test/AllIndexControllerTest.scala index 8465e57a8ff..eb489792cfc 100644 --- a/applications/test/AllIndexControllerTest.scala +++ b/applications/test/AllIndexControllerTest.scala @@ -108,7 +108,9 @@ import play.api.test.Helpers._ it should "correctly serve all pages for `default editionalised sections` in the International edition" in { val result = - allIndexController.all("commentisfree")(TestRequest("/commentisfree/all").withHeaders("X-Gu-Edition" -> "INT")) + allIndexController.all("commentisfree")( + TestRequest("/commentisfree/all?dcr=false").withHeaders("X-Gu-Edition" -> "INT"), + ) status(result) should be(OK) } diff --git a/applications/test/IndexControllerTest.scala b/applications/test/IndexControllerTest.scala index c490d72570d..91c7e1f786e 100644 --- a/applications/test/IndexControllerTest.scala +++ b/applications/test/IndexControllerTest.scala @@ -36,7 +36,7 @@ import play.api.libs.ws.WSClient ) "Index Controller" should "200 when content type is front" in { - val result = indexController.render(section)(TestRequest(s"/$section")) + val result = indexController.render(section)(TestRequest(s"/$section?dcr=false")) status(result) should be(200) } @@ -112,14 +112,14 @@ import play.api.libs.ws.WSClient } it should "not accidentally truncate tags that contain valid strings that are also editions" in { - val request = FakeRequest(GET, "/uk/london?page=2") + val request = FakeRequest(GET, "/uk/london?page=2&dcr=false") val result = indexController.render("uk/london")(request) status(result) should be(200) } it should "not add editions to section tags" in { - val request = FakeRequest(GET, "/sport?page=2") + val request = FakeRequest(GET, "/sport?page=2&dcr=false") val result = indexController.render("sport")(request) status(result) should be(200) diff --git a/applications/test/IndexMetaDataTest.scala b/applications/test/IndexMetaDataTest.scala index 6fd21515827..89f0212cec6 100644 --- a/applications/test/IndexMetaDataTest.scala +++ b/applications/test/IndexMetaDataTest.scala @@ -35,32 +35,32 @@ import play.api.test.Helpers._ ) it should "Include organisation metadata" in { - val result = indexController.render(articleUrl)(TestRequest(articleUrl)) + val result = indexController.render(articleUrl)(TestRequest(s"$articleUrl?dcr=false")) MetaDataMatcher.ensureOrganisation(result) } it should "Include webpage metadata" in { - val result = indexController.render(articleUrl)(TestRequest(articleUrl)) + val result = indexController.render(articleUrl)(TestRequest(s"$articleUrl?dcr=false")) MetaDataMatcher.ensureWebPage(result, articleUrl) } it should "Include app deep link" in { - val result = indexController.render(articleUrl)(TestRequest(articleUrl)) + val result = indexController.render(articleUrl)(TestRequest(s"$articleUrl?dcr=false")) MetaDataMatcher.ensureDeepLink(result) } it should "Not include app deep link on the crosswords index" in { - val result = indexController.render(crosswordsUrl)(TestRequest(crosswordsUrl)) + val result = indexController.render(crosswordsUrl)(TestRequest(s"$crosswordsUrl?dcr=false")) MetaDataMatcher.ensureNoDeepLink(result) } it should "not include webpage metadata on the crossword index" in { - val result = indexController.render(crosswordsUrl)(TestRequest(crosswordsUrl)) + val result = indexController.render(crosswordsUrl)(TestRequest(s"$crosswordsUrl?dcr=false")) MetaDataMatcher.ensureNoIosUrl(result) } it should "Include item list metadata" in { - val result = indexController.render(articleUrl)(TestRequest(articleUrl)) + val result = indexController.render(articleUrl)(TestRequest(s"$articleUrl?dcr=false")) val body = Jsoup.parseBodyFragment(contentAsString(result)) status(result) should be(200) diff --git a/applications/test/SectionTemplateTest.scala b/applications/test/SectionTemplateTest.scala index c8238897c1f..c969679eddb 100644 --- a/applications/test/SectionTemplateTest.scala +++ b/applications/test/SectionTemplateTest.scala @@ -11,22 +11,23 @@ import scala.jdk.CollectionConverters._ @DoNotDiscover class SectionTemplateTest extends AnyFlatSpec with Matchers with ConfiguredTestSuite { - it should "render front title" in goTo("/uk-news") { browser => + it should "render front title" in goTo("/uk-news?dcr=false") { browser => browser.el("[data-test-id=header-title]").text should be("UK news") } - it should "add alternate pages to editionalised sections for /uk/culture" in goTo("/uk/culture") { browser => - val alternateLinks = getAlternateLinks(browser) - alternateLinks.size should be(3) - alternateLinks.exists(link => - toPath(link.attribute("href")) == "/us/culture" && link.attribute("hreflang") == "en-US", - ) should be(true) - alternateLinks.exists(link => - toPath(link.attribute("href")) == "/au/culture" && link.attribute("hreflang") == "en-AU", - ) should be(true) - alternateLinks.exists(link => - toPath(link.attribute("href")) == "/uk/culture" && link.attribute("hreflang") == "en-GB", - ) should be(true) + it should "add alternate pages to editionalised sections for /uk/culture" in goTo("/uk/culture?dcr=false") { + browser => + val alternateLinks = getAlternateLinks(browser) + alternateLinks.size should be(3) + alternateLinks.exists(link => + toPath(link.attribute("href")) == "/us/culture" && link.attribute("hreflang") == "en-US", + ) should be(true) + alternateLinks.exists(link => + toPath(link.attribute("href")) == "/au/culture" && link.attribute("hreflang") == "en-AU", + ) should be(true) + alternateLinks.exists(link => + toPath(link.attribute("href")) == "/uk/culture" && link.attribute("hreflang") == "en-GB", + ) should be(true) } @@ -40,7 +41,7 @@ import scala.jdk.CollectionConverters._ }) } - it should "not add alternate pages to non editionalised sections" in goTo("/books") { browser => + it should "not add alternate pages to non editionalised sections" in goTo("/books?dcr=false") { browser => val alternateLinks = getAlternateLinks(browser) alternateLinks should be(empty) } diff --git a/applications/test/TagFeatureTest.scala b/applications/test/TagFeatureTest.scala index 13372087d35..7809e4427b1 100644 --- a/applications/test/TagFeatureTest.scala +++ b/applications/test/TagFeatureTest.scala @@ -17,7 +17,7 @@ import org.scalatest.matchers.should.Matchers Given("I visit a tag page") - goTo("/technology/askjack") { browser => + goTo("/technology/askjack?dcr=false") { browser => val trails = browser.$(".fc-item__container") trails.asScala.length should be(IndexPagePagination.pageSize) } @@ -31,7 +31,7 @@ import org.scalatest.matchers.should.Matchers Given("I visit the 'Jemima Kiss' contributor page") Switches.ImageServerSwitch.switchOn() - goTo("/profile/jemimakiss") { browser => + goTo("/profile/jemimakiss?dcr=false") { browser => Then("I should see her profile image") val profileImage = browser.el("[data-test-id=header-image]") profileImage.attribute("src") should include(s"42593747/Jemima-Kiss.jpg") @@ -41,7 +41,7 @@ import org.scalatest.matchers.should.Matchers Scenario("Should not not display profiles where they don't exist") { Given("I visit the 'Sam Jones' contributor page") - goTo("/profile/samjones") { browser => + goTo("/profile/samjones?dcr=false") { browser => Then("I should not see her profile image") val profileImages = browser.find(".profile__img img") profileImages.asScala.length should be(0) @@ -65,7 +65,7 @@ import org.scalatest.matchers.should.Matchers Given("I visit the 'Cycling' tag page") - goTo("/sport/cycling") { browser => + goTo("/sport/cycling?dcr=false") { browser => import browser._ val cardsOnFirstPage = browser.find("[data-test-id=facia-card]") @@ -96,7 +96,7 @@ import org.scalatest.matchers.should.Matchers Given("I visit page 2 of the 'Cycling' tag page") - goTo("/sport/cycling?page=2") { browser => + goTo("/sport/cycling?page=2&dcr=false") { browser => import browser._ val cardsOnNextPage = browser.find("[data-test-id=facia-card]") diff --git a/applications/test/TagTemplateTest.scala b/applications/test/TagTemplateTest.scala index 549fa051e8d..15dcee9bfdb 100644 --- a/applications/test/TagTemplateTest.scala +++ b/applications/test/TagTemplateTest.scala @@ -6,7 +6,7 @@ import org.scalatest.matchers.should.Matchers @DoNotDiscover class TagTemplateTest extends AnyFlatSpec with Matchers with ConfiguredTestSuite { - it should "render tag headline" in goTo("/world/turkey") { browser => + it should "render tag headline" in goTo("/world/turkey?dcr=false") { browser => browser.el("[data-test-id=header-title]").text should be("Turkey") } } diff --git a/common/app/conf/switches/FeatureSwitches.scala b/common/app/conf/switches/FeatureSwitches.scala index 84075240ca7..182c5b7f63d 100644 --- a/common/app/conf/switches/FeatureSwitches.scala +++ b/common/app/conf/switches/FeatureSwitches.scala @@ -524,4 +524,14 @@ trait FeatureSwitches { sellByDate = never, exposeClientSide = false, ) + + val DCRTagPages = Switch( + group = SwitchGroup.Feature, + name = "dcr-tag-pages", + description = "Render tag pages with DCR", + owners = Seq(Owner.withGithub("dotcom.platform@theguardian.com")), + safeState = On, + sellByDate = never, + exposeClientSide = false, + ) } diff --git a/common/app/experiments/Experiments.scala b/common/app/experiments/Experiments.scala index 15b6e8e0d6d..d93ab442379 100644 --- a/common/app/experiments/Experiments.scala +++ b/common/app/experiments/Experiments.scala @@ -12,7 +12,6 @@ object ActiveExperiments extends ExperimentsDefinition { override val allExperiments: Set[Experiment] = Set( DarkModeWeb, - DCRTagPages, UpdatedHeaderDesign, UpdateLogoAdPartner, MastheadWithHighlights, @@ -58,15 +57,6 @@ object UpdateLogoAdPartner participationGroup = Perc0A, ) -object DCRTagPages - extends Experiment( - name = "dcr-tag-pages", - description = "Render tag pages with DCR", - owners = Seq(Owner.withGithub("dotcom.platform@theguardian.com")), - sellByDate = LocalDate.of(2024, 5, 31), - participationGroup = Perc20A, - ) - object TagLinkDesign extends Experiment( name = "tag-link-design", diff --git a/facia/test/FaciaMetaDataTest.scala b/facia/test/FaciaMetaDataTest.scala index f338e7e2e77..40f3700cdbc 100644 --- a/facia/test/FaciaMetaDataTest.scala +++ b/facia/test/FaciaMetaDataTest.scala @@ -60,12 +60,12 @@ import scala.concurrent.duration._ } it should "Include webpage metadata" in { - val result = faciaController.renderFront(frontPath)(TestRequest(frontPath)) + val result = faciaController.renderFront(frontPath)(TestRequest(s"$frontPath?dcr=false")) MetaDataMatcher.ensureWebPage(result, frontPath) } it should "Include item list metadata" in { - val result = faciaController.renderFront(frontPath)(TestRequest(frontPath)) + val result = faciaController.renderFront(frontPath)(TestRequest(s"$frontPath?dcr=false")) val body = Jsoup.parseBodyFragment(contentAsString(result)) status(result) should be(200) From 5282874205385e96c4e12ddf901a38476041ad43 Mon Sep 17 00:00:00 2001 From: Daniel Clifton <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Thu, 30 May 2024 09:28:18 +0100 Subject: [PATCH 7/8] Update footer links (#27187) --- common/app/navigation/FooterLinks.scala | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/common/app/navigation/FooterLinks.scala b/common/app/navigation/FooterLinks.scala index 093e73f3057..8d2dedcec8f 100644 --- a/common/app/navigation/FooterLinks.scala +++ b/common/app/navigation/FooterLinks.scala @@ -21,7 +21,12 @@ object FooterLinks { val termsAndConditions = FooterLink("Terms & conditions", "/help/terms-of-service", "terms") def help(edition: String): FooterLink = - FooterLink("Help", "/help", s"${edition} : footer : tech feedback", "js-tech-feedback-report") + FooterLink( + "Help", + "https://manage.theguardian.com/help-centre", + s"${edition} : footer : tech feedback", + "js-tech-feedback-report", + ) def workForUs(edition: String): FooterLink = FooterLink("Work for us", "https://workforus.theguardian.com", s"${edition} : footer : work for us") @@ -88,8 +93,8 @@ object FooterLinks { FooterLink("LinkedIn", "https://www.linkedin.com/company/theguardian", s"${edition} : footer : linkedin") def instagram(edition: String): FooterLink = FooterLink("Instagram", "https://www.instagram.com/guardian", s"${edition} : footer : instagram") - def twitter(edition: String): FooterLink = - FooterLink("Twitter", "https://twitter.com/guardian", s"${edition}: footer : twitter") + def x(edition: String): FooterLink = + FooterLink("X", "https://x.com/guardian", s"${edition}: footer : twitter") def newsletters(edition: String): FooterLink = FooterLink( text = "Newsletters", @@ -110,7 +115,7 @@ object FooterLinks { youtube("uk"), instagram("uk"), linkedin("uk"), - twitter("uk"), + x("uk"), newsletters("uk"), ) @@ -122,7 +127,7 @@ object FooterLinks { youtube("us"), instagram("us"), linkedin("us"), - twitter("us"), + x("us"), newsletters("us"), ) @@ -135,7 +140,7 @@ object FooterLinks { youtube("au"), instagram("au"), linkedin("au"), - twitter("au"), + x("au"), newsletters("au"), ) @@ -147,7 +152,7 @@ object FooterLinks { youtube("international"), instagram("international"), linkedin("international"), - twitter("international"), + x("international"), newsletters("international"), ) From f2c54a6df0344e80468208dd94deb8adf42f45ee Mon Sep 17 00:00:00 2001 From: Max Duval Date: Thu, 30 May 2024 13:42:13 +0100 Subject: [PATCH 8/8] fix: Listr2 custom renderer (#27189) no more subscribe method, but rather event emitters --- .../task-runner/run-task-verbose-formater.js | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/tools/task-runner/run-task-verbose-formater.js b/tools/task-runner/run-task-verbose-formater.js index e3567a1006c..faff4700703 100644 --- a/tools/task-runner/run-task-verbose-formater.js +++ b/tools/task-runner/run-task-verbose-formater.js @@ -12,37 +12,34 @@ const log = (title, parents, message = '') => { const render = (tasks, parents = []) => { // eslint-disable-next-line no-restricted-syntax for (const task of tasks) { - task.subscribe(event => { - if (event.type === 'SUBTASKS') { - render(task.subtasks, parents.concat([task.title])); - return; + task.on('SUBTASKS', event => { + render(task.subtasks, parents.concat([task.title])); + }); + task.on('STATE', event => { + if (task.isPending()) { + log(task.title, parents, chalk.dim('...')); + } + if (task.hasFailed()) { + log(task.title, parents, chalk.red(figures.cross)); } - if (event.type === 'STATE') { - if (task.isPending()) { - log(task.title, parents, chalk.dim('...')); - } - if (task.hasFailed()) { - log(task.title, parents, chalk.red(figures.cross)); - } - if (task.isSkipped()) { - log( - task.title, - parents, - `${chalk.dim(figures.arrowDown)} (${task.output})` - ); - } - if ( - task.isCompleted() && - !task.hasFailed() && - !task.isSkipped() - ) { - log(task.title, parents, chalk.dim.green(figures.tick)); - } + if (task.isSkipped()) { + log( + task.title, + parents, + `${chalk.dim(figures.arrowDown)} (${task.output})` + ); } - if (event.type === 'DATA') { - console.log(event.data); + if ( + task.isCompleted() && + !task.hasFailed() && + !task.isSkipped() + ) { + log(task.title, parents, chalk.dim.green(figures.tick)); } }); + task.on('DATA', event => { + console.log(event.data); + }); } };