Skip to content
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

Merged
merged 6 commits into from
Mar 12, 2020

Conversation

shtukas
Copy link
Contributor

@shtukas shtukas commented Mar 11, 2020

What does this change?

Multiple refactorings in common/app/layout (to help with Onward refactoring). Notably segregate types into their own scala files.

@shtukas shtukas merged commit ce0a32b into master Mar 12, 2020
@shtukas shtukas deleted the ph-20200311-refactoring-for-the-greater-good branch March 12, 2020 10:53
@prout-bot
Copy link
Collaborator

Seen on PROD (merged by @shtukas 13 minutes and 41 seconds ago)

Comment on lines +210 to +220
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
Copy link
Member

@rtyley rtyley Aug 2, 2022

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:

@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?

Copy link
Contributor Author

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 PaidCards but without rendering anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants