[#4] fixed duplication when managing attendance

This commit is contained in:
Camille Moussu
2025-08-01 15:24:07 +02:00
parent 38dfb49dc8
commit a71d1f12fb
3 changed files with 15 additions and 12 deletions
+4 -4
View File
@@ -16,12 +16,12 @@ describe("parseCalendarEvent", () => {
["SUMMARY", {}, "text", "Team Meeting"], ["SUMMARY", {}, "text", "Team Meeting"],
["DESCRIPTION", {}, "text", "Discuss roadmap"], ["DESCRIPTION", {}, "text", "Discuss roadmap"],
["LOCATION", {}, "text", "Zoom"], ["LOCATION", {}, "text", "Zoom"],
["ORGANIZER", { cn: "Alice" }, "cal-address", "mailto:alice@example.com"], ["ORGANIZER", { cn: "Alice" }, "cal-address", "alice@example.com"],
[ [
"ATTENDEE", "ATTENDEE",
{ cn: "Bob", partstat: "ACCEPTED" }, { cn: "Bob", partstat: "ACCEPTED" },
"cal-address", "cal-address",
"mailto:bob@example.com", "bob@example.com",
], ],
["X-OPENPAAS-VIDEOCONFERENCE", {}, "text", "https://meet.link"], ["X-OPENPAAS-VIDEOCONFERENCE", {}, "text", "https://meet.link"],
["STATUS", {}, "text", "CONFIRMED"], ["STATUS", {}, "text", "CONFIRMED"],
@@ -98,8 +98,8 @@ describe("parseCalendarEvent", () => {
const rawData = [ const rawData = [
["UID", {}, "text", "event-4"], ["UID", {}, "text", "event-4"],
["DTSTART", {}, "date-time", "2025-07-18T09:00:00Z"], ["DTSTART", {}, "date-time", "2025-07-18T09:00:00Z"],
["ATTENDEE", {}, "cal-address", "mailto:john@example.com"], ["ATTENDEE", {}, "cal-address", "john@example.com"],
["ORGANIZER", {}, "cal-address", "mailto:jane@example.com"], ["ORGANIZER", {}, "cal-address", "jane@example.com"],
] as unknown as [string, Record<string, string>, string, any]; ] as unknown as [string, Record<string, string>, string, any];
const result = parseCalendarEvent(rawData, baseColor, calendarId); const result = parseCalendarEvent(rawData, baseColor, calendarId);
+10 -7
View File
@@ -139,15 +139,18 @@ export function calendarEventToJCal(event: CalendarEvent): any[] {
} }
event.attendee.forEach((att) => { event.attendee.forEach((att) => {
const attendee: Record<string, string> = {
partstat: att.partstat,
rsvp: att.rsvp,
role: att.role,
cutype: att.cutype,
};
if (att.cn) {
attendee.cn = att.cn;
}
vevent[1].push([ vevent[1].push([
"attendee", "attendee",
{ attendee,
cn: att.cn,
partstat: att.partstat,
rsvp: att.rsvp,
role: att.role,
cutype: att.cutype,
},
"cal-address", "cal-address",
`mailto:${att.cal_address}`, `mailto:${att.cal_address}`,
]); ]);
+1 -1
View File
@@ -14,7 +14,7 @@ export interface userOrganiser {
} }
export interface userAttendee { export interface userAttendee {
cn: string; cn?: string;
cal_address: string; cal_address: string;
partstat: string; partstat: string;
rsvp: string; rsvp: string;