Skip to content

Commit

Permalink
Add missing case in IndexController
Browse files Browse the repository at this point in the history
Co-authored-by: Roberto Tyley <roberto.tyley@guardian.co.uk>
  • Loading branch information
ioannakok and rtyley committed Aug 2, 2022
1 parent 9a0c058 commit b429232
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions common/app/controllers/IndexControllerCommon.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,26 @@ trait IndexControllerCommon
path match {
//if this is a section tag e.g. football/football
case TagPattern(left, right) if left == right => successful(Cached(60)(redirect(left, request.isRss)))
case _ => {
case _ =>
logGoogleBot(request)
index(Edition(request), path, inferPage(request), request.isRss) map {
case Left(model) if model.contents.nonEmpty => renderFaciaFront(model)
// if no content is returned (as often happens with old/expired/migrated microsites) return 404 rather than an empty page
case Left(model) if model.contents.isEmpty =>
Cached(60)(
WithoutRevalidationResult(
Gone(
views.html.gone(
gonePage,
"Sorry - there is no content here",
"This could be, for example, because content associated with it is not yet published, or due to legal reasons such as the expiry of our rights to publish the content.",
case Left(model) =>
if (model.contents.nonEmpty) renderFaciaFront(model)
else
Cached(60)(
WithoutRevalidationResult(
Gone(
views.html.gone(
gonePage,
"Sorry - there is no content here",
"This could be, for example, because content associated with it is not yet published, or due to legal reasons such as the expiry of our rights to publish the content.",
),
),
),
),
)
)
case Right(other) => RenderOtherStatus(other)
}
}

}

override def canRender(item: ItemResponse): Boolean = item.section.orElse(item.tag).isDefined
Expand Down

0 comments on commit b429232

Please sign in to comment.