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) => {
// If calendar is synced to an external account, show the account label
if (calendar.syncConfig && calendar.syncConfig.mailCredential) {
const accountLabel =
calendar.syncConfig.mailCredential.display_name ||
calendar.syncConfig.mailCredential.email;
return accountLabel || (calendar.name === "Default" ? "Privée" : calendar.name);
// If calendar is synced to an external account, always show the account name
// (same logic as in courrier page: display_name || email)
if (calendar.syncConfig?.syncEnabled && calendar.syncConfig?.mailCredential) {
return calendar.syncConfig.mailCredential.display_name ||
calendar.syncConfig.mailCredential.email;
}
// Legacy default name
if (calendar.name === "Default") {
// For non-synced calendars, use the calendar name
// Legacy default name handling
if (calendar.name === "Default" || calendar.name === "Privée") {
return "Privée";
}