Agenda Sync refactor

This commit is contained in:
alma 2026-01-14 14:04:27 +01:00
parent 3de29f94e1
commit 8fc1fa2fae

View File

@ -843,16 +843,16 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
}; };
const getCalendarDisplayName = (calendar: CalendarWithMission) => { const getCalendarDisplayName = (calendar: CalendarWithMission) => {
// If calendar is synced to an external account, show the account label // If calendar is synced to an external account, always show the account name
if (calendar.syncConfig && calendar.syncConfig.mailCredential) { // (same logic as in courrier page: display_name || email)
const accountLabel = if (calendar.syncConfig?.syncEnabled && calendar.syncConfig?.mailCredential) {
calendar.syncConfig.mailCredential.display_name || return calendar.syncConfig.mailCredential.display_name ||
calendar.syncConfig.mailCredential.email; calendar.syncConfig.mailCredential.email;
return accountLabel || (calendar.name === "Default" ? "Privée" : calendar.name);
} }
// Legacy default name // For non-synced calendars, use the calendar name
if (calendar.name === "Default") { // Legacy default name handling
if (calendar.name === "Default" || calendar.name === "Privée") {
return "Privée"; return "Privée";
} }