courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 14:41:44 +02:00
parent d6728947c6
commit 795a9f4629

View File

@ -275,13 +275,9 @@ export async function getEmails(
console.log(`Fetching emails for user ${userId}${accountId ? ` account ${accountId}` : ''} in folder ${folder}`);
// Try to get from cache first
const cacheKey = accountId
? `email:list:${userId}:${accountId}:${folder}:${page}:${perPage}:${searchQuery}`
: `email:list:${userId}:${folder}:${page}:${perPage}:${searchQuery}`;
const cached = await getCachedEmailList(userId, accountId || 'default', folder, page, perPage);
if (cached) {
console.log(`Using cached email list for ${cacheKey}`);
console.log(`Using cached email list for ${userId}${accountId ? ` account ${accountId}` : ''} in folder ${folder}`);
return cached;
}
@ -356,7 +352,7 @@ export async function getEmails(
mailboxes: await getMailboxes(client)
};
// Cache the result
// Cache the result with the correct accountId
await cacheEmailList(userId, accountId || 'default', folder, page, perPage, result);
return result;