Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fixing ICS file in workflows & ICS calendar descriptions #16731

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

joeauyeung
Copy link
Contributor

What does this PR do?

For our emails we use generateIcsString() while in workflows they had their own function to generate ICS strings. We should keep the calendar events unified. By doing this we solve two problems

  • Double calendar events on calendars because the ICS file had a different UID than the calendar event we created when the booking was made
  • Syncing calendar events with relevant information by removing the title and subtitle from the calendar description

Before

CleanShot 2024-09-19 at 15 10 13@2x

After

CleanShot 2024-09-19 at 15 10 31@2x

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings
@keithwillcode keithwillcode added consumer core area: core, team members only labels Sep 19, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the title, subtitle, role, and isRequestRescheduled params as they are not needed anymore.

@@ -283,7 +282,9 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
attachments: reminder.workflowStep.includeCalendarEvent
? [
{
content: Buffer.from(getiCalEventAsString(reminder.booking) || "").toString("base64"),
content: Buffer.from(
generateIcsString({ event: reminder.booking, status: "CONFIRMED" }) || ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume that we only schedule workflow emails for confirmed bookings.

@@ -258,12 +207,8 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
const batchId = await getBatchId();

function sendEmail(data: Partial<MailData>, triggerEvent?: WorkflowTriggerEvents) {
const status: ParticipationStatus =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This status should be for the whole event and not just an attendee.

@@ -258,12 +207,8 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
const batchId = await getBatchId();

function sendEmail(data: Partial<MailData>, triggerEvent?: WorkflowTriggerEvents) {
const status: ParticipationStatus =
triggerEvent === WorkflowTriggerEvents.AFTER_EVENT
? "COMPLETED"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COMPLETED is not part of the ICS standard. Most calendars handle bookings in the past on their own

@joeauyeung joeauyeung marked this pull request as ready for review September 19, 2024 19:17
@graphite-app graphite-app bot requested a review from a team September 19, 2024 19:18
Copy link

vercel bot commented Sep 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 7:18pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 7:18pm
@dosubot dosubot bot added emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email workflows area: workflows, automations labels Sep 19, 2024
Copy link

graphite-app bot commented Sep 19, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (09/19/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email workflows area: workflows, automations
2 participants