diff --git a/app/agenda/page.tsx b/app/agenda/page.tsx index 97820c2..e27fa3b 100644 --- a/app/agenda/page.tsx +++ b/app/agenda/page.tsx @@ -58,8 +58,7 @@ export default async function CalendarPage() { { name: { in: ["Privée", "Default"] } }, { syncConfig: { - isNot: null, - syncEnabled: true + isNot: null } } ] @@ -199,8 +198,7 @@ export default async function CalendarPage() { { name: { in: ["Privée", "Default"] } }, { syncConfig: { - isNot: null, - syncEnabled: true + isNot: null } } ] @@ -233,6 +231,18 @@ export default async function CalendarPage() { }); // No default calendar creation - only synced calendars from courrier + + // Filter out "Privée" and "Default" calendars that don't have active sync + calendars = calendars.filter(cal => { + const isPrivateOrDefault = cal.name === "Privée" || cal.name === "Default"; + const hasActiveSync = cal.syncConfig?.syncEnabled === true && cal.syncConfig?.mailCredential; + + // Exclude "Privée"/"Default" calendars that are not actively synced + if (isPrivateOrDefault && !hasActiveSync) { + return false; + } + return true; + }); const now = new Date(); const nextWeek = add(now, { days: 7 });