-
Notifications
You must be signed in to change notification settings - Fork 8k
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 [CAL-4409] #16731
Conversation
There was a problem hiding this comment.
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" }) || "" |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
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. "Add foundation team as reviewer" took an action on this PR • (09/25/24)1 reviewer was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix the type errors? 🙏
const organizerT = await getTranslation(bookingInfo.organizer.language.locale, "common"); | ||
|
||
const attendeePromises = []; | ||
for (const attendee of bookingInfo.attendees) { | ||
attendeePromises.push( | ||
getTranslation(attendee.language.locale ?? "en", "common").then((tAttendee) => ({ | ||
...attendee, | ||
language: { translate: tAttendee, locale: attendee.language.locale ?? "en" }, | ||
})) | ||
); | ||
} | ||
|
||
const attendees = await Promise.all(attendeePromises); | ||
|
||
const emailEvent = { | ||
...bookingInfo, | ||
type: bookingInfo.eventType.slug!, | ||
organizer: { | ||
...bookingInfo.organizer, | ||
language: { ...bookingInfo.organizer.language, translate: organizerT }, | ||
}, | ||
attendees, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to do that in other places too where we call scheduleEmailReminder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch on this. I added this logic inside of scheduleEmailReminder
so when calling it we don't have to worry about getting all the translations before passing the event object.
E2E results are ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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 problemsBefore
After
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist