Skip to content

Commit

Permalink
Merge pull request #4336 from guardian/add-force-cropping-gutters-for…
Browse files Browse the repository at this point in the history
…-configured-users

add `displayCropGutterByDefaultTo` (optional Set[String]) config option to Kahuna
  • Loading branch information
twrichards authored Sep 27, 2024
2 parents 2b424de + 7ef7d31 commit 186a4fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kahuna/app/controllers/KahunaController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ class KahunaController(

val isIFramed = request.headers.get("Sec-Fetch-Dest").contains("iframe")
val featureSwitches = new FeatureSwitches(
List(if(config.staffPhotographerOrganisation == "GNM") ShowCroppingGuttersSwitch else ExampleSwitch)
List(
if (maybeUser.map(_.accessor.identity).exists(config.displayCropGutterByDefaultTo.contains))
ShowCroppingGuttersSwitch.copy(default = true)
else if(config.staffPhotographerOrganisation == "GNM")
ShowCroppingGuttersSwitch
else
ExampleSwitch
)
)
val featureSwitchesWithClientValues = featureSwitches.getClientSwitchValues(featureSwitches.getFeatureSwitchCookies(request.cookies.get))
val featureSwitchesJson = Json.stringify(Json.toJson(featureSwitches.getFeatureSwitchesToStringify(featureSwitchesWithClientValues)))
Expand Down
2 changes: 2 additions & 0 deletions kahuna/app/lib/KahunaConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,7 @@ class KahunaConfig(resources: GridConfigResources) extends CommonConfig(resource
.getOrElse("Not configured")

val shouldUploadStraightToBucket: Boolean = maybeIngestBucket.isDefined

val displayCropGutterByDefaultTo: Set[String] = getStringSet("displayCropGutterByDefaultTo")
}

0 comments on commit 186a4fe

Please sign in to comment.