-
Notifications
You must be signed in to change notification settings - Fork 554
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
Multiple refactorings in common/app/layout #22392
Conversation
Seen on PROD (merged by @shtukas 13 minutes and 41 seconds ago)
|
case class PaidCard( | ||
icon: Option[String], | ||
headline: String, | ||
kicker: Option[String], | ||
description: Option[String], | ||
image: Option[ImageMedia], | ||
fallbackImageUrl: Option[String], | ||
targetUrl: String, | ||
cardTypes: Option[ItemClasses] = None, | ||
branding: Option[Branding] | ||
) extends FaciaCard |
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.
Hi @shtukas ! We're doing the Scala 2.13 upgrade in #25190, and the match-exhaustiveness check has pointed out that PaidCard
is not handled in this pattern-match expression in the template that renders FaciaCard
instances on regular (non-commercial?) fronts:
frontend/common/app/views/fragments/items/facia_cards/item.scala.html
Lines 31 to 56 in 95f470a
@item match { | |
case paidContentOnEditorialPage: ContentCard if paidContentOnEditorialPage.branding.exists(_.isPaid) && !frontProperties.exists(_.isPaidContent) => { | |
@paidContentCard( | |
item = paidContentOnEditorialPage, | |
omnitureId = mkInteractionTrackingCode(containerIndex, index, paidContentOnEditorialPage, containerDisplayName, frontId), | |
containerIndex, | |
index, | |
isFirstContainer | |
) | |
} | |
case content: ContentCard if isStoryPackage => { | |
@dynamoContentCard(content, containerIndex, index, card.visibilityDataAttribute, isFirstContainer, isList) | |
} | |
case content: ContentCard => { | |
@contentCard(content, containerIndex, index, card.visibilityDataAttribute, isFirstContainer, isList) | |
} | |
case htmlBlob: HtmlBlob => { | |
<div class="@GetClasses.forHtmlBlob(htmlBlob)">@htmlBlob.html</div> | |
} | |
} | |
} |
....we were wondering what we should do to satisfy the compiler here? Have a blank case for PaidCard
? There's already some logic around paidContentOnEditorialPage
that seems to be in the same space?
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.
My instinct would be to maintain the existing behaviour and add a case
for PaidCard
s but without rendering anything.
What does this change?
Multiple refactorings in
common/app/layout
(to help with Onward refactoring). Notably segregate types into their own scala files.