mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Parse the author name from email address
This commit is contained in:
parent
f7d46752e1
commit
0a2598e296
2 changed files with 10 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ import {
|
|||
handleGoogleConfirmationEmail,
|
||||
isGoogleConfirmationEmail,
|
||||
isSubscriptionConfirmationEmail,
|
||||
parseAuthor,
|
||||
parseUnsubscribe,
|
||||
} from './newsletter'
|
||||
import { handlePdfAttachment } from './pdf'
|
||||
|
|
@ -182,7 +183,7 @@ export const inboundEmailHandler = Sentry.GCPFunction.wrapHttpFunction(
|
|||
content: html,
|
||||
url: generateUniqueUrl(),
|
||||
title: subject,
|
||||
author: from,
|
||||
author: parseAuthor(from),
|
||||
text,
|
||||
unsubMailTo: unsubscribe.mailTo,
|
||||
unsubHttpUrl: unsubscribe.httpUrl,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@ const parseAddress = (address: string): string => {
|
|||
return ''
|
||||
}
|
||||
|
||||
export const parseAuthor = (address: string): string => {
|
||||
const parsed = addressparser(address)
|
||||
if (parsed.length > 0) {
|
||||
return parsed[0].name
|
||||
}
|
||||
return address
|
||||
}
|
||||
|
||||
export const handleGoogleConfirmationEmail = async (
|
||||
email: string,
|
||||
subject: string
|
||||
|
|
|
|||
Loading…
Reference in a new issue