Skip to content

Scheduling infrastructure for absolutely everyone.

Fix Caldav not valid destination calendar and only display calendars that user can edit (#3326)

Joe Au-Yeungbf7c86ffe564
diff --git a/apps/web/components/DestinationCalendarSelector.tsx b/apps/web/components/DestinationCalendarSelector.tsx
index 96f28b1f6d1..25f4a7f5ac9 100644
--- a/apps/web/components/DestinationCalendarSelector.tsx
+++ b/apps/web/components/DestinationCalendarSelector.tsx
@@ -61,10 +61,12 @@ const DestinationCalendarSelector = ({
query.data.connectedCalendars.map((selectedCalendar) => ({
key: selectedCalendar.credentialId,
label: `${selectedCalendar.integration.title} (${selectedCalendar.primary?.name})`,
- options: (selectedCalendar.calendars ?? []).map((cal) => ({
- label: cal.name || "",
- value: `${cal.integration}:${cal.externalId}`,
- })),
+ options: (selectedCalendar.calendars ?? [])
+ .filter((cal) => cal.readOnly === false)
+ .map((cal) => ({
+ label: cal.name || "",
+ value: `${cal.integration}:${cal.externalId}`,
+ })),
})) ?? [];
return (
<div className="relative" title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}>
diff --git a/packages/core/CalendarManager.ts b/packages/core/CalendarManager.ts
index eb7f7c2137d..a4192f1295e 100644
--- a/packages/core/CalendarManager.ts
+++ b/packages/core/CalendarManager.ts
@@ -44,6 +44,7 @@ export const getConnectedCalendars = async (
const calendars = _(cals)
.map((cal) => ({
...cal,
+ readOnly: cal.readOnly || false,
primary: cal.primary || null,
isSelected: selectedCalendars.some((selected) => selected.externalId === cal.externalId),
credentialId,