Skip to content

Set GCal & Outlook iCalUID in .ics file#8010

Merged
emrysal merged 21 commits intomainfrom
set-ics-uid-to-calendar-uid
Apr 3, 2023
Merged

Set GCal & Outlook iCalUID in .ics file#8010
emrysal merged 21 commits intomainfrom
set-ics-uid-to-calendar-uid

Conversation

@joeauyeung
Copy link
Copy Markdown
Contributor

@joeauyeung joeauyeung commented Mar 29, 2023

What does this PR do?

This PR fixes Gmail parsing our .ics file and adding double events in GCal by adding the iCalUID when creating events to the .ics file we generate.

Fixes # (issue)

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Connect GCal
  • Create an event
  • From the email get the .ics file
  • Send the .ics to your inbox. When clicking "View on Google Calendar" it should open the event that we created
  • Reschedule that booking
  • The new .ics file should still point to the event that we created

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works
  • I haven't checked if new and existing unit tests pass locally with my changes

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2023

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

Name Status Preview Comments Updated (UTC)
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 5:05pm
cal-com-web ❌ Failed (Inspect) Apr 3, 2023 5:05pm
web ❌ Failed (Inspect) Apr 3, 2023 5:05pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
ui ⬜️ Ignored (Inspect) Visit Preview Apr 3, 2023 5:05pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 29, 2023

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 233.35 KB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Sixty-six Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/404 8.45 KB 241.79 KB 69.08% (+/- <0.01%)
/[user] 70.21 KB 303.56 KB 86.73% (+/- <0.01%)
/[user]/[type] 91.95 KB 325.29 KB 92.94% (+/- <0.01%)
/[user]/[type]/embed 91.98 KB 325.32 KB 92.95% (+/- <0.01%)
/[user]/book 183.54 KB 416.89 KB 119.11% (+/- <0.01%)
/[user]/embed 70.28 KB 303.62 KB 86.75% (+/- <0.01%)
/apps 167.2 KB 400.55 KB 114.44% (+/- <0.01%)
/apps/[slug] 190.92 KB 424.27 KB 121.22% (+/- <0.01%)
/apps/[slug]/[...pages] 392.19 KB 625.53 KB 178.72% (🟡 +0.01%)
/apps/categories 152.1 KB 385.45 KB 110.13% (+/- <0.01%)
/apps/categories/[category] 155.97 KB 389.31 KB 111.23% (+/- <0.01%)
/apps/installed/[category] 196.95 KB 430.3 KB 122.94% (+/- <0.01%)
/auth/error 19.24 KB 252.59 KB 72.17% (+/- <0.01%)
/auth/forgot-password 25.63 KB 258.98 KB 73.99% (+/- <0.01%)
/auth/forgot-password/[id] 32.83 KB 266.18 KB 76.05% (+/- <0.01%)
/auth/login 40.1 KB 273.45 KB 78.13% (+/- <0.01%)
/auth/logout 7.56 KB 240.91 KB 68.83% (+/- <0.01%)
/availability 155.41 KB 388.75 KB 111.07% (+/- <0.01%)
/availability/[schedule] 272.17 KB 505.51 KB 144.43% (+/- <0.01%)
/availability/troubleshoot 152.79 KB 386.14 KB 110.32% (+/- <0.01%)
/booking/[uid] 123.64 KB 356.98 KB 101.99% (🟡 +0.01%)
/bookings/[status] 272.5 KB 505.84 KB 144.53% (+/- <0.01%)
/d/[link]/[slug] 91.6 KB 324.94 KB 92.84% (+/- <0.01%)
/d/[link]/[slug]/embed 91.63 KB 324.97 KB 92.85% (+/- <0.01%)
/d/[link]/book 183.19 KB 416.54 KB 119.01% (+/- <0.01%)
/event-types 349.15 KB 582.49 KB 166.43% (+/- <0.01%)
/event-types/[type] 383.03 KB 616.38 KB 176.11% (+/- <0.01%)
/insights 387.25 KB 620.6 KB 177.31% (+/- <0.01%)
/more 151.73 KB 385.07 KB 110.02% (+/- <0.01%)
/settings/admin 157.18 KB 390.53 KB 111.58% (+/- <0.01%)
/settings/admin/apps 165.87 KB 399.21 KB 114.06% (+/- <0.01%)
/settings/admin/apps/[category] 165.85 KB 399.2 KB 114.06% (+/- <0.01%)
/settings/admin/flags 160.08 KB 393.42 KB 112.41% (+/- <0.01%)
/settings/admin/impersonation 157.46 KB 390.81 KB 111.66% (+/- <0.01%)
/settings/billing 157.29 KB 390.64 KB 111.61% (+/- <0.01%)
/settings/developer/api-keys 186.45 KB 419.79 KB 119.94% (+/- <0.01%)
/settings/developer/webhooks 159.95 KB 393.29 KB 112.37% (+/- <0.01%)
/settings/developer/webhooks/[id] 190.64 KB 423.98 KB 121.14% (+/- <0.01%)
/settings/developer/webhooks/new 190.5 KB 423.84 KB 121.10% (+/- <0.01%)
/settings/my-account/appearance 171.24 KB 404.59 KB 115.60% (+/- <0.01%)
/settings/my-account/calendars 191.48 KB 424.83 KB 121.38% (+/- <0.01%)
/settings/my-account/conferencing 163.1 KB 396.45 KB 113.27% (+/- <0.01%)
/settings/my-account/general 266.45 KB 499.79 KB 142.80% (+/- <0.01%)
/settings/my-account/profile 274.27 KB 507.62 KB 145.03% (+/- <0.01%)
/settings/security/impersonation 159.33 KB 392.68 KB 112.19% (+/- <0.01%)
/settings/security/password 192.63 KB 425.98 KB 121.71% (+/- <0.01%)
/settings/security/sso 167.03 KB 400.37 KB 114.39% (+/- <0.01%)
/settings/security/two-factor-auth 161.85 KB 395.19 KB 112.91% (+/- <0.01%)
/settings/teams 156.93 KB 390.27 KB 111.51% (+/- <0.01%)
/settings/teams/[id]/appearance 171.26 KB 404.61 KB 115.60% (+/- <0.01%)
/settings/teams/[id]/billing 157.16 KB 390.51 KB 111.57% (+/- <0.01%)
/settings/teams/[id]/members 297.26 KB 530.61 KB 151.60% (+/- <0.01%)
/settings/teams/[id]/profile 269.48 KB 502.83 KB 143.66% (+/- <0.01%)
/settings/teams/[id]/sso 167.12 KB 400.47 KB 114.42% (+/- <0.01%)
/signup 25.5 KB 258.84 KB 73.95% (+/- <0.01%)
/team/[slug] 72.62 KB 305.97 KB 87.42% (+/- <0.01%)
/team/[slug]/[type] 91.6 KB 324.95 KB 92.84% (+/- <0.01%)
/team/[slug]/[type]/embed 91.63 KB 324.98 KB 92.85% (+/- <0.01%)
/team/[slug]/book 183.2 KB 416.54 KB 119.01% (+/- <0.01%)
/team/[slug]/embed 72.69 KB 306.03 KB 87.44% (+/- <0.01%)
/teams 151.94 KB 385.29 KB 110.08% (+/- <0.01%)
/video/meeting-ended/[uid] 14.67 KB 248.01 KB 70.86% (+/- <0.01%)
/video/meeting-not-started/[uid] 14.3 KB 247.64 KB 70.76% (+/- <0.01%)
/video/no-meeting-found 6.6 KB 239.95 KB 68.56% (+/- <0.01%)
/workflows 164.95 KB 398.29 KB 113.80% (+/- <0.01%)
/workflows/[workflow] 294.07 KB 527.42 KB 150.69% (+/- <0.01%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@joeauyeung joeauyeung marked this pull request as ready for review March 29, 2023 16:45
@joeauyeung joeauyeung requested a review from zomars as a code owner March 29, 2023 16:45
@joeauyeung joeauyeung requested review from a team March 29, 2023 16:45
Comment on lines +1025 to +1030
const updateManager = await eventManager.reschedule(copyEvent, rescheduleUid, newBooking.id);

const calendarResult = results.find((result) => result.type.includes("_calendar"));

evt.iCalUID = calendarResult.updatedEvent.iCalUID || undefined;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Throughout handleNewBooking a copy of the original evt object is passed into the reschedule method but we want to update the evt object. We could pass the evt object into the reschedule method and copy it in there. My concern is maintainability if we're changing objects inside of other methods

recurrenceRule = new RRule(this.calEvent.recurringEvent).toString().replace("RRULE:", "");
}
const partstat: ParticipationStatus = "NEEDS-ACTION";
const partstat: ParticipationStatus = "ACCEPTED";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When we create events on calendars we already set attendees to accepted

Comment on lines +140 to +142
evt.iCalUID = isCalendarResult(result)
? result.createdEvent?.iCalUID
: createdEventObj?.iCalUID || undefined;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GCal & Outlook have iCalUID properties in their responses

id: z.string(),
password: z.union([z.string(), z.undefined()]),
onlineMeetingUrl: z.string().nullable(),
iCalUID: z.string().optional(),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Setup to pass iCalUID from other calendars


const responseJson = await handleErrorsJson(response);

return { ...responseJson, iCalUID: responseJson.iCalUId };
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Notice in Outlook the property has a lower case "d". Through out the call I think we should standardize it to UID as that's the property name in the .ics file

@joeauyeung joeauyeung changed the title Set GCal iCalUID in .ics file Set GCal & Outlook iCalUID in .ics file Mar 29, 2023
@deploysentinel
Copy link
Copy Markdown

deploysentinel bot commented Mar 29, 2023

Current Playwright Test Results Summary

✅ 60 Passing - ⚠️ 1 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 04/03/2023 05:13:22pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 8c3c471

Started: 04/03/2023 05:08:43pm UTC

⚠️ Flakes

📄   packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Routing Forms Seeded Routing Form Routing Link - Reporting and CSV Download
Retry 1Initial Attempt
9.09% (15) 15 / 165 runs
failed over last 7 days
26.06% (43) 43 / 165 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

This does not work when i have selected secondary calendar as destination.

First i scheduled the event

Screenshot 2023-03-30 at 6 23 33 PM

then i rescheduled the event to 30th april which created event in both primary and secondary calendar

Screenshot 2023-03-30 at 6 28 47 PM

@Udit-takkar
Copy link
Copy Markdown
Contributor

@joeauyeung i fixed something similar before here #7406 . maybe we should do the same thing in updateEvent method in googlecalendar/lib/CalendarService

@PeerRich PeerRich added the Urgent Created by Linear-GitHub Sync label Apr 2, 2023
const partstat: ParticipationStatus = "ACCEPTED";
const role: ParticipationRole = "REQ-PARTICIPANT";
const icsEvent = createEvent({
uid: this.calEvent.iCalUID || this.calEvent.uid!,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We set non-null for uid here since every booking should have a uid associated with it on Cal

@emrysal emrysal requested a review from Udit-takkar April 3, 2023 09:12
Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

LGTM. working fine

Copy link
Copy Markdown
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Reverted the serverConfig change, but besides that it looks good to me 🙏 🎉

@PeerRich PeerRich added the ♻️ autoupdate tells kodiak to keep this branch up-to-date label Apr 3, 2023
@emrysal emrysal removed the ♻️ autoupdate tells kodiak to keep this branch up-to-date label Apr 3, 2023
@emrysal emrysal merged commit 2e0951d into main Apr 3, 2023
@emrysal emrysal deleted the set-ics-uid-to-calendar-uid branch April 3, 2023 17:13
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only Urgent Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants