[#50] fixed sent invite to appear on invitee calendar

This commit is contained in:
Camille Moussu
2025-08-01 11:10:16 +02:00
committed by Benoit TELLIER
parent eac718cfdc
commit 5cdce4201a
4 changed files with 18 additions and 13 deletions
@@ -33,7 +33,7 @@ describe("Event Display", () => {
list: { list: {
"667037022b752d0026472254/cal1": { "667037022b752d0026472254/cal1": {
id: "667037022b752d0026472254/cal1", id: "667037022b752d0026472254/cal1",
name: "Calendar 1", name: "Calendar",
color: "#FF0000", color: "#FF0000",
events: { events: {
event1: { event1: {
@@ -94,7 +94,7 @@ describe("Event Display", () => {
).toBeInTheDocument(); ).toBeInTheDocument();
expect(screen.getByText(/\d{2}:\d{2} \d{2}:\d{2}/)).toBeInTheDocument(); expect(screen.getByText(/\d{2}:\d{2} \d{2}:\d{2}/)).toBeInTheDocument();
expect(screen.getByText("Calendar 1")).toBeInTheDocument(); expect(screen.getByText("Calendar")).toBeInTheDocument();
}); });
it("calls onClose when Cancel clicked", () => { it("calls onClose when Cancel clicked", () => {
renderWithProviders( renderWithProviders(
+11 -6
View File
@@ -147,7 +147,7 @@ describe("calendarEventToJCal", () => {
repetition: "WEEKLY", repetition: "WEEKLY",
organizer: { organizer: {
cn: "Alice", cn: "Alice",
cal_address: "mailto:alice@example.com", cal_address: "alice@example.com",
}, },
attendee: [ attendee: [
{ {
@@ -156,7 +156,7 @@ describe("calendarEventToJCal", () => {
rsvp: "TRUE", rsvp: "TRUE",
role: "REQ-PARTICIPANT", role: "REQ-PARTICIPANT",
cutype: "INDIVIDUAL", cutype: "INDIVIDUAL",
cal_address: "mailto:bob@example.com", cal_address: "bob@example.com",
}, },
], ],
}; };
@@ -173,8 +173,13 @@ describe("calendarEventToJCal", () => {
["uid", {}, "text", "event-123"], ["uid", {}, "text", "event-123"],
["summary", {}, "text", "Team Meeting"], ["summary", {}, "text", "Team Meeting"],
["transp", {}, "text", "OPAQUE"], ["transp", {}, "text", "OPAQUE"],
["dtstart", { tzid: "Europe/Paris" }, "date-time", "20250723T100000"], [
["dtend", { tzid: "Europe/Paris" }, "date-time", "20250723T110000"], "dtstart",
{ tzid: "Europe/Paris" },
"date-time",
"2025-07-23T10:00:00",
],
["dtend", { tzid: "Europe/Paris" }, "date-time", "2025-07-23T11:00:00"],
["class", {}, "text", "PUBLIC"], ["class", {}, "text", "PUBLIC"],
["location", {}, "text", "Room 101"], ["location", {}, "text", "Room 101"],
["description", {}, "text", "Discuss project roadmap."], ["description", {}, "text", "Discuss project roadmap."],
@@ -253,7 +258,7 @@ describe("calendarEventToJCal", () => {
repetition: "WEEKLY", repetition: "WEEKLY",
organizer: { organizer: {
cn: "Alice", cn: "Alice",
cal_address: "mailto:alice@example.com", cal_address: "alice@example.com",
}, },
attendee: [ attendee: [
{ {
@@ -262,7 +267,7 @@ describe("calendarEventToJCal", () => {
rsvp: "TRUE", rsvp: "TRUE",
role: "REQ-PARTICIPANT", role: "REQ-PARTICIPANT",
cutype: "INDIVIDUAL", cutype: "INDIVIDUAL",
cal_address: "mailto:bob@example.com", cal_address: "bob@example.com",
}, },
], ],
}; };
+4 -4
View File
@@ -125,7 +125,7 @@ export function calendarEventToJCal(event: CalendarEvent): any[] {
"organizer", "organizer",
{ cn: event.organizer.cn }, { cn: event.organizer.cn },
"cal-address", "cal-address",
event.organizer.cal_address, `mailto:${event.organizer.cal_address}`,
]); ]);
} }
if (event.location) { if (event.location) {
@@ -149,7 +149,7 @@ export function calendarEventToJCal(event: CalendarEvent): any[] {
cutype: att.cutype, cutype: att.cutype,
}, },
"cal-address", "cal-address",
att.cal_address, `mailto:${att.cal_address}`,
]); ]);
}); });
@@ -160,7 +160,7 @@ export function calendarEventToJCal(event: CalendarEvent): any[] {
return ["vcalendar", [], [vevent, vtimezone.component.jCal]]; return ["vcalendar", [], [vevent, vtimezone.component.jCal]];
} }
function formatDateToICal(date: Date, allday: Boolean) { function formatDateToICal(date: Date, allday: Boolean) {
// Format date like: 20250214T110000 (local time) // Format date like: 2025-02-14T11:00:00 (local time)
const pad = (n: number) => n.toString().padStart(2, "0"); const pad = (n: number) => n.toString().padStart(2, "0");
const year = date.getFullYear(); const year = date.getFullYear();
@@ -172,5 +172,5 @@ function formatDateToICal(date: Date, allday: Boolean) {
if (allday) { if (allday) {
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
} }
return `${year}${month}${day}T${hours}${minutes}${seconds}`; return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
} }
+1 -1
View File
@@ -24,7 +24,7 @@ export const userSlice = createSlice({
if (!state.organiserData) { if (!state.organiserData) {
state.organiserData = {} as userOrganiser; state.organiserData = {} as userOrganiser;
} }
state.organiserData.cn = action.payload.sub; state.organiserData.cn = action.payload.name;
state.organiserData.cal_address = `mailto:${action.payload.email}`; state.organiserData.cal_address = `mailto:${action.payload.email}`;
}, },
setTokens: (state, action) => { setTokens: (state, action) => {