Skip to content

Commit

Permalink
add europe beta front test and prevent users seeing the beta front un…
Browse files Browse the repository at this point in the history
…less opted into test (#27536)
  • Loading branch information
cemms1 authored Oct 15, 2024
1 parent 41c2e20 commit 45f1f57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 14 additions & 0 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ object ActiveExperiments extends ExperimentsDefinition {
Set(
RemoveLiteFronts,
MastheadWithHighlights,
EuropeBetaFront,
DarkModeWeb,
)
implicit val canCheckExperiment: CanCheckExperiment = new CanCheckExperiment(this)
Expand All @@ -28,6 +29,19 @@ object MastheadWithHighlights
participationGroup = Perc50,
)

object EuropeBetaFront
extends Experiment(
name = "europe-beta-front",
description = "Allows viewing the beta version of the Europe network front",
owners = Seq(
Owner.withGithub("cemms1"),
Owner.withEmail("[email protected]"),
Owner.withEmail("[email protected]"),
),
sellByDate = LocalDate.of(2025, 4, 2),
participationGroup = Perc0A,
)

object DarkModeWeb
extends Experiment(
name = "dark-mode-web",
Expand Down
9 changes: 8 additions & 1 deletion facia/app/controllers/FaciaController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import common._
import conf.Configuration
import conf.switches.Switches.InlineEmailStyles
import controllers.front._
import experiments.{ActiveExperiments, RemoveLiteFronts}
import experiments.{ActiveExperiments, EuropeBetaFront, RemoveLiteFronts}
import http.HttpPreconnections
import implicits.GUHeaders
import layout.slices._
Expand Down Expand Up @@ -223,6 +223,13 @@ trait FaciaController
private[controllers] def renderFrontPressResult(path: String)(implicit request: RequestHeader): Future[Result] = {
val NonAdFreeType = if (ActiveExperiments.isParticipating(RemoveLiteFronts)) FullType else LiteType

// Europe beta experiment
// Phase 1 prevents users from being able to view the europe-beta front unless opted into the test
val inEuropeBetaTest = ActiveExperiments.isParticipating(EuropeBetaFront)
if (path == "europe-beta" && !inEuropeBetaTest) {
return successful(Cached(CacheTime.NotFound)(WithoutRevalidationResult(NotFound)))
}

val futureFaciaPage: Future[Option[(PressedPage, Boolean)]] = frontJsonFapi.get(path, requestType).flatMap {
case Some(faciaPage: PressedPage) =>
val pageContainsTargetedCollections = TargetedCollections.pageContainsTargetedCollections(faciaPage)
Expand Down

0 comments on commit 45f1f57

Please sign in to comment.