From b17ac56b50555f13277050dd20096878e653b075 Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 28 Apr 2025 17:39:08 +0200 Subject: [PATCH] courrier multi account restore compose --- app/courrier/page.tsx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index d364f301..ffeeb73e 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -358,11 +358,13 @@ export default function CourrierPage() { ? account.folders : []; - // Only add folders that actually exist for this account - const validFolders = accountFolders.filter((folder: string) => { - // Remove any account prefix if present - const baseFolder = folder.includes(':') ? folder.split(':')[1] : folder; - return baseFolder && baseFolder.trim() !== ''; + // Keep the account prefix in folder names + const validFolders = accountFolders.map((folder: string) => { + // If folder doesn't have account prefix, add it + if (!folder.includes(':')) { + return `${account.id}:${folder}`; + } + return folder; }); updatedAccounts.push({ @@ -619,23 +621,24 @@ export default function CourrierPage() { // Update the folder button rendering to show selected state based on account const renderFolderButton = (folder: string, accountId: string) => { - // Remove account prefix from folder name for comparison - const baseFolder = folder.includes(':') ? folder.split(':')[1] : folder; + // Get the account prefix from the folder name + const folderAccountId = folder.includes(':') ? folder.split(':')[0] : accountId; + + // Only show folders that belong to this account + if (folderAccountId !== accountId) return null; const isSelected = selectedFolders[accountId] === folder; const account = accounts.find(a => a.id === accountId); - // Check if this folder belongs to this account - const isVisible = account?.folders?.includes(baseFolder) || false; - - if (!isVisible) return null; + // Get the base folder name for display + const baseFolder = folder.includes(':') ? folder.split(':')[1] : folder; return (