save reply-to in recent emails

This commit is contained in:
Hongbo Wu
2024-04-08 23:05:50 +08:00
parent 289d750a05
commit 764b05fff4
5 changed files with 17 additions and 2 deletions

View File

@ -33,6 +33,12 @@ export class ReceivedEmail {
@Column('text')
html!: string
@Column('text')
replyTo?: string
@Column('text')
reply?: string
@Column('text')
type!: 'article' | 'non-article'

View File

@ -27,6 +27,7 @@ interface EmailMessage {
text: string
forwardedFrom?: string
receivedEmailId: string
replyTo?: string
}
function isEmailMessage(data: any): data is EmailMessage {
@ -165,7 +166,9 @@ export function emailsServiceRouter() {
req.body.subject,
req.body.text,
req.body.html,
user.id
user.id,
'non-article',
req.body.replyTo
)
analytics.capture({

View File

@ -2547,6 +2547,8 @@ const schema = gql`
type: String!
text: String!
html: String
replyTo: String
reply: String
createdAt: Date!
}

View File

@ -8,7 +8,8 @@ export const saveReceivedEmail = async (
text: string,
html: string,
userId: string,
type: 'article' | 'non-article' = 'non-article'
type: 'article' | 'non-article' = 'non-article',
replyTo?: string
): Promise<ReceivedEmail> => {
return authTrx(
(t) =>
@ -20,6 +21,7 @@ export const saveReceivedEmail = async (
html,
type,
user: { id: userId },
replyTo,
}),
undefined,
userId

View File

@ -120,6 +120,7 @@ export const inboundEmailHandler = Sentry.GCPFunction.wrapHttpFunction(
// original sender email address
const from = parsed['from']
const replyTo = parsed['reply-to']
const subject = parsed['subject']
const html = parsed['html']
const text = parsed['text']
@ -140,6 +141,7 @@ export const inboundEmailHandler = Sentry.GCPFunction.wrapHttpFunction(
subject,
html,
text,
replyTo,
})
try {