Skip to content

Commit

Permalink
feat(author): relax r&w block constraint for alternate author tpl
Browse files Browse the repository at this point in the history
  • Loading branch information
mlbrgl committed May 7, 2024
1 parent 5e7f5cb commit 83ed1a3
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions db/model/Gdoc/rawToEnriched.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1636,40 +1636,6 @@ function parseExpandableParagraph(
function parseResearchAndWritingBlock(
raw: RawBlockResearchAndWriting
): EnrichedBlockResearchAndWriting {
const createError = (
error: ParseError,
heading = "",
hideAuthors = false,
primary = [
{
value: { url: "" },
},
],
secondary = [
{
value: { url: "" },
},
],
more: EnrichedBlockResearchAndWritingRow = {
heading: "",
articles: [],
},
latest: EnrichedBlockResearchAndWritingRow = {
heading: "",
articles: [],
},
rows: EnrichedBlockResearchAndWritingRow[] = []
): EnrichedBlockResearchAndWriting => ({
type: "research-and-writing",
heading,
"hide-authors": hideAuthors,
primary,
secondary,
more,
latest,
rows,
parseErrors: [error],
})
const parseErrors: ParseError[] = []

function enrichLink(
Expand Down Expand Up @@ -1729,12 +1695,10 @@ function parseResearchAndWritingBlock(
})
}

if (!raw.value.primary)
return createError({ message: "Missing primary link" })
const primary: EnrichedBlockResearchAndWritingLink[] = []
if (isArray(raw.value.primary)) {
primary.push(...raw.value.primary.map((link) => enrichLink(link)))
} else {
} else if (raw.value.primary) {
primary.push(enrichLink(raw.value.primary))
}

Expand Down

0 comments on commit 83ed1a3

Please sign in to comment.