fix: archive meeting during host-change reschedules (#25098)
This commit is contained in:
@@ -123,6 +123,10 @@ export default class HubspotCalendarService implements CRM {
|
||||
return this.hubspotClient.crm.objects.meetings.basicApi.update(uid, simplePublicObjectInput);
|
||||
};
|
||||
|
||||
private hubspotArchiveMeeting = async (uid: string) => {
|
||||
return this.hubspotClient.crm.objects.meetings.basicApi.archive(uid);
|
||||
};
|
||||
|
||||
private hubspotAuth = async (credential: CredentialPayload) => {
|
||||
const appKeys = await getAppKeysFromSlug("hubspot");
|
||||
if (typeof appKeys.client_id === "string") this.client_id = appKeys.client_id;
|
||||
@@ -212,9 +216,14 @@ export default class HubspotCalendarService implements CRM {
|
||||
return await this.hubspotUpdateMeeting(uid, event);
|
||||
}
|
||||
|
||||
async deleteEvent(uid: string): Promise<void> {
|
||||
async deleteEvent(uid: string, event: CalendarEvent): Promise<void> {
|
||||
const auth = await this.auth;
|
||||
await auth.getToken();
|
||||
|
||||
if (event?.hasOrganizerChanged) {
|
||||
await this.hubspotArchiveMeeting(uid);
|
||||
return;
|
||||
}
|
||||
await this.hubspotCancelMeeting(uid);
|
||||
}
|
||||
|
||||
|
||||
@@ -1884,6 +1884,7 @@ async function handler(
|
||||
evt.videoCallData = undefined;
|
||||
// To prevent "The requested identifier already exists" error while updating event, we need to remove iCalUID
|
||||
evt.iCalUID = undefined;
|
||||
evt.hasOrganizerChanged = true;
|
||||
}
|
||||
|
||||
if (changedOrganizer && originalRescheduledBooking?.user) {
|
||||
|
||||
Vendored
+1
@@ -222,6 +222,7 @@ export interface CalendarEvent {
|
||||
domainWideDelegationCredentialId?: string | null;
|
||||
customReplyToEmail?: string | null;
|
||||
rescheduledBy?: string;
|
||||
hasOrganizerChanged?: boolean;
|
||||
}
|
||||
|
||||
export interface EntryPoint {
|
||||
|
||||
Reference in New Issue
Block a user