-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DCR flag and picker for Image Content #26169
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d88027f
Adding the dcr picker and flag for Image Content
alinaboghiu 59133e0
formatting
alinaboghiu e8e9b1a
maybe I need these DB files?
alinaboghiu e3b7551
reduce Image Content experiment to 0 instead of 50
alinaboghiu f8c0245
Merge branch 'main' into image-picker
alinaboghiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
48 changes: 48 additions & 0 deletions
48
applications/app/services/dotcomrendering/ImageContentPicker.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,48 @@ | ||
package services.dotcomrendering | ||
|
||
import common.GuLogging | ||
import experiments.{ActiveExperiments, DCRImageContent} | ||
import model.Cors.RichRequestHeader | ||
import model.ImageContentPage | ||
import play.api.mvc.RequestHeader | ||
import utils.DotcomponentsLogger | ||
|
||
object ImageContentPicker extends GuLogging { | ||
|
||
/** | ||
* | ||
* Add to this function any logic for including/excluding | ||
* an image article from being rendered with DCR | ||
* | ||
* Currently defaulting to false until we implement image articles in DCR | ||
* | ||
* */ | ||
private def dcrCouldRender(imageContentPage: ImageContentPage): Boolean = { | ||
false | ||
} | ||
|
||
def getTier( | ||
imageContentPage: ImageContentPage, | ||
)(implicit | ||
request: RequestHeader, | ||
): RenderType = { | ||
|
||
val participatingInTest = ActiveExperiments.isParticipating(DCRImageContent) | ||
val dcrCanRender = dcrCouldRender(imageContentPage) | ||
|
||
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, imageContentPage.image) | ||
} else { | ||
DotcomponentsLogger.logger.logRequest(s"path executing in web", Map.empty, imageContentPage.image) | ||
} | ||
|
||
tier | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
...ions/app/services/InteractivePicker.scala → ...s/dotcomrendering/InteractivePicker.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
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,5 @@ | ||
package services.dotcomrendering | ||
|
||
sealed trait RenderType | ||
case object RemoteRender extends RenderType | ||
case object LocalRender extends RenderType |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package model | ||
|
||
case class ImageContentPage(image: ImageContent, related: RelatedContent) extends ContentPage { | ||
override lazy val item: ImageContent = image | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this should be 50% 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha! I will change to 0