Skip to content

Commit

Permalink
Always render Image Content with DCR
Browse files Browse the repository at this point in the history
  • Loading branch information
alinaboghiu committed Feb 2, 2024
1 parent 39c3c13 commit ebaaf50
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 76 deletions.
16 changes: 2 additions & 14 deletions applications/app/controllers/ImageContentController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import play.api.libs.ws.WSClient
import play.api.mvc._
import renderers.DotcomRenderingService
import services.ImageQuery
import services.dotcomrendering.{ImageContentPicker, RemoteRender}
import services.dotcomrendering.RemoteRender
import views.support.RenderOtherStatus

import scala.concurrent.Future
Expand All @@ -36,21 +36,9 @@ class ImageContentController(

def render(path: String): Action[AnyContent] = Action.async { implicit request => renderItem(path) }

private def renderImageContent(page: ImageContentPage)(implicit request: RequestHeader): Result = {
val htmlResponse = () => ContentHtmlPage.html(page)
val jsonResponse = () => views.html.fragments.imageContentBody(page)
renderFormat(htmlResponse, jsonResponse, page, Switches.all)
}

override def renderItem(path: String)(implicit request: RequestHeader): Future[Result] =
image(Edition(request), path).flatMap {
case Right((content, mainBlock)) =>
val tier = ImageContentPicker.getTier(content, mainBlock)

tier match {
case RemoteRender => remoteRender(content, mainBlock)
case _ => Future.successful(renderImageContent(content))
}
case Right((content, mainBlock)) => remoteRender(content, mainBlock)
case Left(result) => Future.successful(RenderOtherStatus(result))
}

Expand Down
52 changes: 0 additions & 52 deletions applications/app/services/dotcomrendering/ImageContentPicker.scala

This file was deleted.

10 changes: 0 additions & 10 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ object DeeplyRead
participationGroup = Perc50,
)

// Removing while we are still implementing this content type in DCR
//object DCRImageContent
// extends Experiment(
// name = "dcr-image-content",
// description = "Use DCR for image content",
// owners = Seq(Owner.withGithub("@guardian/dotcom-platform")),
// sellByDate = LocalDate.of(2024, 1, 1),
// participationGroup = Perc0E,
// )

object AdaptiveSite
extends Experiment(
name = "adaptive-site",
Expand Down

0 comments on commit ebaaf50

Please sign in to comment.