-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add DCR flag and picker for Galleries * formatting * request blocks from capi * update test to use ws client plus these db files * fix imports
- Loading branch information
1 parent
d6fe041
commit 66c651c
Showing
10 changed files
with
143 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
applications/app/services/dotcomrendering/GalleryPicker.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package services.dotcomrendering | ||
|
||
import common.GuLogging | ||
import model.Cors.RichRequestHeader | ||
import model.GalleryPage | ||
import play.api.mvc.RequestHeader | ||
import utils.DotcomponentsLogger | ||
|
||
object GalleryPicker extends GuLogging { | ||
|
||
/** | ||
* | ||
* Add to this function any logic for including/excluding | ||
* a gallery article from being rendered with DCR | ||
* | ||
* Currently defaulting to false until we implement image articles in DCR | ||
* | ||
* */ | ||
private def dcrCouldRender(galleryPage: GalleryPage): Boolean = { | ||
false | ||
} | ||
|
||
def getTier( | ||
galleryPage: GalleryPage, | ||
)(implicit | ||
request: RequestHeader, | ||
): RenderType = { | ||
|
||
val participatingInTest = false // until we create a test for this content type | ||
val dcrCanRender = dcrCouldRender(galleryPage) | ||
|
||
val tier = { | ||
if (request.forceDCROff) LocalRender | ||
else if (request.forceDCR) RemoteRender | ||
else if (dcrCanRender && participatingInTest) RemoteRender | ||
else LocalRender | ||
} | ||
|
||
if (tier == RemoteRender) { | ||
DotcomponentsLogger.logger.logRequest(s"path executing in dotcomponents", Map.empty, galleryPage.gallery) | ||
} else { | ||
DotcomponentsLogger.logger.logRequest(s"path executing in web", Map.empty, galleryPage.gallery) | ||
} | ||
|
||
tier | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+16 KB
data/database/2ac3ae477853198e531d4c6bdfb02540adff7769c8bbad05d6a3125f1d00dc8e
Binary file not shown.
Binary file added
BIN
+16 KB
data/database/346f499f7e3c3a75c9aa7e82b397b79bbb5b884682a8fda2ccea5f1e85c2ef49
Binary file not shown.
Binary file added
BIN
+128 KB
data/database/36a02251b82a1a4487024e63d7267e7c0a4f81092415c77687318f9c0a71ad6e
Binary file not shown.
Binary file added
BIN
+512 KB
data/database/80a8849569a5ac89c1b335b646f03b6654256ad469e5954e6ec4a3857dc92faf
Binary file not shown.
Binary file added
BIN
+128 KB
data/database/c2a8ff87b8f717ad283be8a69bb336e51923c7de8b65ab65bcee2ff6dfde6f94
Binary file not shown.