fix: different calendar hosts (#24000)

* fis: pass the missing `platformClientId` to `handleNewBooking` in api/v2

* Update formatCalendarEvent.ts

* only add the externald in case of same calendar, otherwise add if from the .ics file sent in email

* Revert "fis: pass the missing `platformClientId` to `handleNewBooking` in api/v2"

This reverts commit 030ac0f0981c1135d4973fbdafa62d58e8985831.

* fix: alow the host change logic to run for collective envets as well

* fix: run the changedOrganizer logic for both collective and round-robin events

* Update handleNewBooking.ts

* fix: failing unit test

---------

Co-authored-by: Lauris Skraucis <lauris.skraucis@gmail.com>
This commit is contained in:
chauhan_s
2025-10-01 12:15:34 +03:00
committed by GitHub
co-authored by Lauris Skraucis
parent 43cc40d7fe
commit 52a5afeba5
4 changed files with 13 additions and 13 deletions
@@ -481,7 +481,9 @@ export default class Office365CalendarService implements Calendar {
.map((member) => {
const destinationCalendar =
event.destinationCalendar &&
event.destinationCalendar.find((cal) => cal.userId === member.id);
event.destinationCalendar.find(
(cal) => cal.integration === this.integrationName && cal.userId === member.id
);
return {
emailAddress: {
address: destinationCalendar?.externalId ?? member.email,
@@ -1480,7 +1480,7 @@ async function handler(
const changedOrganizer =
!!originalRescheduledBooking &&
eventType.schedulingType === SchedulingType.ROUND_ROBIN &&
(eventType.schedulingType === SchedulingType.ROUND_ROBIN || eventType.schedulingType === SchedulingType.COLLECTIVE) &&
originalRescheduledBooking.userId !== evt.organizer.id;
const skipDeleteEventsAndMeetings = changedOrganizer;
@@ -138,11 +138,7 @@ describe("handleNewBooking", () => {
status: BookingStatus.ACCEPTED,
startTime: `${plus1DateString}T05:00:00.000Z`,
endTime: `${plus1DateString}T05:30:00.000Z`,
users: [
{
id: 101, // organizer
},
],
userId: 101,
references: [
{
type: appStoreMetadata.dailyvideo.type,
+8 -6
View File
@@ -17,10 +17,12 @@ const formatClientIdFromEmails = (calEvent: CalendarEvent | ExtendedCalendarEven
const team = calEvent.team
? {
...calEvent.team,
members: calEvent.team.members.map((member) => ({
...member,
email: member.email.replace(`+${clientId}`, ""),
})),
members: calEvent.team.members.map((member) => {
return {
...member,
email: member.email.replace(`+${clientId}`, ""),
};
}),
}
: undefined;
return [attendees, organizer, team];
@@ -39,8 +41,8 @@ export const formatCalEvent = (calEvent: CalendarEvent) => {
export const formatCalEventExtended = (calEvent: ExtendedCalendarEvent) => {
const clonedEvent = cloneDeep(calEvent);
if (clonedEvent.platformClientId) {
const [attendees, organizer] = formatClientIdFromEmails(clonedEvent, clonedEvent.platformClientId);
Object.assign(clonedEvent, { attendees, organizer });
const [attendees, organizer, team] = formatClientIdFromEmails(clonedEvent, clonedEvent.platformClientId);
Object.assign(clonedEvent, { attendees, organizer, team });
}
return clonedEvent;