Skip to content

Commit 9f277c5

Browse files
authored
fix: archive meeting during host-change reschedules (calcom#25098)
1 parent 21411b8 commit 9f277c5

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/app-store/hubspot/lib/CrmService.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ export default class HubspotCalendarService implements CRM {
123123
return this.hubspotClient.crm.objects.meetings.basicApi.update(uid, simplePublicObjectInput);
124124
};
125125

126+
private hubspotArchiveMeeting = async (uid: string) => {
127+
return this.hubspotClient.crm.objects.meetings.basicApi.archive(uid);
128+
};
129+
126130
private hubspotAuth = async (credential: CredentialPayload) => {
127131
const appKeys = await getAppKeysFromSlug("hubspot");
128132
if (typeof appKeys.client_id === "string") this.client_id = appKeys.client_id;
@@ -212,9 +216,14 @@ export default class HubspotCalendarService implements CRM {
212216
return await this.hubspotUpdateMeeting(uid, event);
213217
}
214218

215-
async deleteEvent(uid: string): Promise<void> {
219+
async deleteEvent(uid: string, event: CalendarEvent): Promise<void> {
216220
const auth = await this.auth;
217221
await auth.getToken();
222+
223+
if (event?.hasOrganizerChanged) {
224+
await this.hubspotArchiveMeeting(uid);
225+
return;
226+
}
218227
await this.hubspotCancelMeeting(uid);
219228
}
220229

packages/features/bookings/lib/service/RegularBookingService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,7 @@ async function handler(
18841884
evt.videoCallData = undefined;
18851885
// To prevent "The requested identifier already exists" error while updating event, we need to remove iCalUID
18861886
evt.iCalUID = undefined;
1887+
evt.hasOrganizerChanged = true;
18871888
}
18881889

18891890
if (changedOrganizer && originalRescheduledBooking?.user) {

packages/types/Calendar.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export interface CalendarEvent {
222222
domainWideDelegationCredentialId?: string | null;
223223
customReplyToEmail?: string | null;
224224
rescheduledBy?: string;
225+
hasOrganizerChanged?: boolean;
225226
}
226227

227228
export interface EntryPoint {

0 commit comments

Comments
 (0)