Skip to content

Commit 9919a3f

Browse files
authored
Respect dcr=true when interactive is pressed (guardian#24672)
* Respect dcr=true when interactive is pressed
1 parent b65a10f commit 9919a3f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

applications/app/services/InteractivePicker.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ object InteractivePicker {
2424
request: RequestHeader,
2525
): RenderingTier = {
2626
// Allows us to press via InterativeLibrarian and also debug interactives rendering via dcr
27-
val forceDCROff = request.forceDCROff
2827
val fullPath = ensureStartingForwardSlash(path)
2928

3029
// Allow us to quickly revert to rendering content (instead of serving pressed content)
3130
val switchOn = InteractivePickerFeature.isSwitchedOn
3231

33-
if (forceDCROff) FrontendLegacy
32+
if (request.forceDCROff) FrontendLegacy
33+
else if (request.forceDCR) DotcomRendering
3434
else if (isPressed(fullPath) && switchOn) PressedInteractive
3535
else DotcomRendering
3636
}

applications/test/services/InteractivePickerTest.scala

+10
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,14 @@ import play.api.test.Helpers._
4242

4343
tier should be(DotcomRendering)
4444
}
45+
46+
it should "return DotcomRendering if interactive is pressed and dcr=true" in {
47+
val testRequest = TestRequest(s"$path?dcr=true")
48+
val tier =
49+
InteractivePicker.getRenderingTier(path, MockPressedInteractives.isPressed)(
50+
testRequest,
51+
)
52+
53+
tier should be(DotcomRendering)
54+
}
4555
}

0 commit comments

Comments
 (0)