From f4112f3160eb90554770d90442dedb3af4da1b55 Mon Sep 17 00:00:00 2001 From: alma Date: Sat, 26 Apr 2025 14:28:56 +0200 Subject: [PATCH] courrier clean 2 --- lib/services/email-service.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/services/email-service.ts b/lib/services/email-service.ts index 8f1bc64d..c02a9dbe 100644 --- a/lib/services/email-service.ts +++ b/lib/services/email-service.ts @@ -631,20 +631,20 @@ export async function testEmailConnection(credentials: EmailCredentials): Promis /** * Format email for reply/forward */ -export function formatEmailForReplyOrForward( +export async function formatEmailForReplyOrForward( email: EmailMessage, type: 'reply' | 'reply-all' | 'forward' -): { +): Promise<{ to: string; cc?: string; subject: string; body: string; -} { +}> { // Format the subject with Re: or Fwd: prefix - const subject = formatSubject(email.subject, type); + const subject = await formatSubject(email.subject, type); // Create the email quote with proper formatting - const quoteHeader = createQuoteHeader(email); + const quoteHeader = await createQuoteHeader(email); const quotedContent = email.html || email.text || ''; // Format recipients @@ -720,7 +720,7 @@ export function formatEmailForReplyOrForward( /** * Format subject with appropriate prefix (Re:, Fwd:) */ -function formatSubject(subject: string, type: 'reply' | 'reply-all' | 'forward'): string { +async function formatSubject(subject: string, type: 'reply' | 'reply-all' | 'forward'): Promise { // Clean up any existing prefixes let cleanSubject = subject .replace(/^(Re|Fwd|FW|Forward):\s*/i, '') @@ -743,7 +743,7 @@ function formatSubject(subject: string, type: 'reply' | 'reply-all' | 'forward') /** * Create a quote header for reply/forward */ -function createQuoteHeader(email: EmailMessage): string { +async function createQuoteHeader(email: EmailMessage): Promise { // Format the date const date = new Date(email.date); const formattedDate = date.toLocaleString('en-US', { @@ -762,4 +762,4 @@ function createQuoteHeader(email: EmailMessage): string { : sender?.address || 'Unknown sender'; return `
On ${formattedDate}, ${fromText} wrote:
`; -} \ No newline at end of file +} \ No newline at end of file