calcom / cal.com

Scheduling infrastructure for absolutely everyone.
https://cal.com
Other
31.23k stars 7.53k forks source link

[CAL-3931] Workflow sent for canceled event #15453

Open milospuac opened 2 months ago

milospuac commented 2 months ago

customer chris.chenko

Screenshot 2024-06-13 at 16.35.39.png

From SyncLinear.com | CAL-3931

dosubot[bot] commented 2 months ago

The issue of reminders for canceled bookings still being sent, as documented under CAL-3931, is due to the fact that the deletion of scheduled reminders is not being handled correctly in some cases. The provided code shows that there is a mechanism to delete scheduled reminders for canceled bookings, but it might not be executed properly or might fail silently.

The solution involves ensuring that all scheduled reminders are properly deleted when a booking is canceled. The code snippet below shows the relevant part where reminders are deleted:

const reminderMethods: { [x: string]: (id: number, referenceId: string | null) => void } = {
  [WorkflowMethods.EMAIL]: deleteScheduledEmailReminder,
  [WorkflowMethods.SMS]: deleteScheduledSMSReminder,
  [WorkflowMethods.WHATSAPP]: deleteScheduledWhatsappReminder,
};

export const cancelWorkflowReminders = async (
  workflowReminders: { method: WorkflowMethods; id: number; referenceId: string | null }[]
) => {
  await Promise.all(
    workflowReminders.map((reminder) => {
      return reminderMethods[reminder.method](reminder.id, reminder.referenceId);
    })
  );
};

Ensure that this part of the code is executed correctly and that any errors are logged and handled appropriately. This should prevent reminders from being sent for canceled bookings [1][2].

To continue talking to Dosu, mention @dosu.

Ayush9026 commented 2 months ago

/assign i will solve this.