Merge pull request #598 from omnivore-app/fix/money-stuff-title

Use newsletter's title and author from emails
This commit is contained in:
Jackson Harper 2022-05-12 09:52:53 -07:00 committed by GitHub
commit b409f40d89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 14 deletions

View file

@ -35,22 +35,19 @@ export const saveEmail = async (
},
true
)
const title = input.title
const content = parseResult.parsedContent?.content || input.originalContent
const slug = generateSlug(title)
const slug = generateSlug(input.title)
const metadata = await parseUrlMetadata(url)
const articleToSave: Page = {
id: '',
userId: ctx.uid,
slug,
content,
originalHtml: input.originalContent,
content: content,
description: metadata?.description || parseResult.parsedContent?.excerpt,
title: metadata?.title || parseResult.parsedContent?.title || title,
author:
metadata?.author || parseResult.parsedContent?.byline || input.author,
title: input.title,
author: input.author,
url: normalizeUrl(parseResult.canonicalUrl || url, {
stripHash: true,
stripWWW: false,
@ -59,7 +56,6 @@ export const saveEmail = async (
hash: stringToHash(content),
image: metadata?.previewImage || parseResult.parsedContent?.previewImage,
publishedAt: validatedDate(parseResult.parsedContent?.publishedDate),
slug: slug,
createdAt: new Date(),
savedAt: new Date(),
readingProgressAnchorIndex: 0,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -77,7 +77,7 @@ export class NewsletterHandler {
const url =
this.parseNewsletterUrl(postHeader, html) ||
`${this.defaultUrl}?source=newsletters&id=${uuidv4()}`
const author = this.parseAuthor(from) || 'Unknown'
const author = this.parseAuthor(from)
const unsubscribe = this.parseUnsubscribe(unSubHeader)
const message = {
email,