diff --git a/__test__/features/Events/eventUtils.test.ts b/__test__/features/Events/eventUtils.test.ts index 44bc8a5..0dd1b55 100644 --- a/__test__/features/Events/eventUtils.test.ts +++ b/__test__/features/Events/eventUtils.test.ts @@ -16,12 +16,12 @@ describe("parseCalendarEvent", () => { ["SUMMARY", {}, "text", "Team Meeting"], ["DESCRIPTION", {}, "text", "Discuss roadmap"], ["LOCATION", {}, "text", "Zoom"], - ["ORGANIZER", { cn: "Alice" }, "cal-address", "mailto:alice@example.com"], + ["ORGANIZER", { cn: "Alice" }, "cal-address", "alice@example.com"], [ "ATTENDEE", { cn: "Bob", partstat: "ACCEPTED" }, "cal-address", - "mailto:bob@example.com", + "bob@example.com", ], ["X-OPENPAAS-VIDEOCONFERENCE", {}, "text", "https://meet.link"], ["STATUS", {}, "text", "CONFIRMED"], @@ -98,8 +98,8 @@ describe("parseCalendarEvent", () => { const rawData = [ ["UID", {}, "text", "event-4"], ["DTSTART", {}, "date-time", "2025-07-18T09:00:00Z"], - ["ATTENDEE", {}, "cal-address", "mailto:john@example.com"], - ["ORGANIZER", {}, "cal-address", "mailto:jane@example.com"], + ["ATTENDEE", {}, "cal-address", "john@example.com"], + ["ORGANIZER", {}, "cal-address", "jane@example.com"], ] as unknown as [string, Record, string, any]; const result = parseCalendarEvent(rawData, baseColor, calendarId); diff --git a/src/features/Events/eventUtils.ts b/src/features/Events/eventUtils.ts index 6751b78..df9defe 100644 --- a/src/features/Events/eventUtils.ts +++ b/src/features/Events/eventUtils.ts @@ -139,15 +139,18 @@ export function calendarEventToJCal(event: CalendarEvent): any[] { } event.attendee.forEach((att) => { + const attendee: Record = { + partstat: att.partstat, + rsvp: att.rsvp, + role: att.role, + cutype: att.cutype, + }; + if (att.cn) { + attendee.cn = att.cn; + } vevent[1].push([ "attendee", - { - cn: att.cn, - partstat: att.partstat, - rsvp: att.rsvp, - role: att.role, - cutype: att.cutype, - }, + attendee, "cal-address", `mailto:${att.cal_address}`, ]); diff --git a/src/features/User/userDataTypes.ts b/src/features/User/userDataTypes.ts index a7fb841..907e9d3 100644 --- a/src/features/User/userDataTypes.ts +++ b/src/features/User/userDataTypes.ts @@ -14,7 +14,7 @@ export interface userOrganiser { } export interface userAttendee { - cn: string; + cn?: string; cal_address: string; partstat: string; rsvp: string;