Skip to content

The open alternative to Salesforce, designed for AI.

Call recorder: cancel the bot of a meeting whose calendar event was destroyed (#26815)

Vlad Bisceanub732b0a28f8c
diff --git a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/reconcile-call-recorder.util.ts b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/reconcile-call-recorder.util.ts
index f15d292f11a..bdb322f5493 100644
--- a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/reconcile-call-recorder.util.ts
+++ b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/reconcile-call-recorder.util.ts
@@ -444,10 +444,19 @@ const reconcileCanceledMeeting = async ({
...meetingPolicyResult.calendarEventIds,
...removedCalendarEventIds,
]);
- const meetingCallRecordings = await findCallRecordingsByCalendarEventIds(
+ const linkedCallRecordings = await findCallRecordingsByCalendarEventIds(
client,
calendarEventIds,
);
+ const orphanedPolicyManagedCallRecordings = (
+ await findCallRecordingsByIds(client, [
+ computeCallRecordingIdForMeeting(meetingPolicyResult.realMeetingKey),
+ ])
+ ).filter((callRecording) => isUndefined(callRecording.calendarEventId));
+ const meetingCallRecordings = [
+ ...linkedCallRecordings,
+ ...orphanedPolicyManagedCallRecordings,
+ ];
const cancellableCallRecordings = meetingCallRecordings.filter(
(callRecording) =>
callRecording.status === CallRecordingStatus.SCHEDULED &&