courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 17:39:08 +02:00
parent f1f8a778bb
commit b17ac56b50

View File

@ -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 (
<Button
key={folder}
variant="ghost"
className={`w-full justify-start text-xs py-1 h-7 ${isSelected ? 'bg-gray-100' : ''}`}
onClick={() => handleMailboxChange(baseFolder, accountId)}
onClick={() => handleMailboxChange(folder, accountId)}
>
<div className="flex items-center w-full">
{getFolderIcon(baseFolder)}