-
Notifications
You must be signed in to change notification settings - Fork 6.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
fix: N Calendar Invites For Collective Events #14610
Conversation
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (04/16/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 • (04/16/24)1 reviewer was added to this PR based on Keith Williams's automation. |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 222 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 04/16/2024 07:07:23pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: e19d594 Started: 04/16/2024 07:03:28pm UTC
|
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Login and logout tests -- legacy Login flow validations -- future Should warn when user does not exist
Retry 1 • Initial Attempt |
0% (0)0 / 284 runsfailed over last 7 days |
1.41% (4)4 / 284 runsflaked over last 7 days |
📄 apps/web/playwright/event-types.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Event Types tests -- legacy user Different Locations Tests Can remove location from multiple locations that are saved
Retry 1 • Initial Attempt |
0% (0)0 / 291 runsfailed over last 7 days |
19.24% (56)56 / 291 runsflaked over last 7 days |
📄 apps/web/playwright/insights.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Insights should be able to go to insights as admins
Retry 1 • Initial Attempt |
0.34% (1)1 / 291 runfailed over last 7 days |
6.87% (20)20 / 291 runsflaked over last 7 days |
📄 apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Stripe integration Pending payment booking should not be confirmed by default
Retry 1 • Initial Attempt |
1.72% (5)5 / 291 runsfailed over last 7 days |
20.96% (61)61 / 291 runsflaked over last 7 days |
📄 apps/web/playwright/profile.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Update Profile Can verify the newly added secondary email
Retry 1 • Initial Attempt |
0% (0)0 / 296 runsfailed over last 7 days |
7.77% (23)23 / 296 runsflaked over last 7 days |
📄 apps/web/playwright/signup.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Signup Flow Test Email verification sent if enabled
Retry 1 • Initial Attempt |
0% (0)0 / 308 runsfailed over last 7 days |
2.27% (7)7 / 308 runsflaked over last 7 days |
📄 apps/web/playwright/change-username.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Change username on settings User can change username
Retry 1 • Initial Attempt |
1.01% (3)3 / 298 runsfailed over last 7 days |
2.68% (8)8 / 298 runsflaked over last 7 days |
📄 apps/web/playwright/teams.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Teams - NonOrg -- future Can create a booking for Round Robin EventType
Retry 1 • Initial Attempt |
0.65% (2)2 / 308 runsfailed over last 7 days |
1.62% (5)5 / 308 runsflaked over last 7 days |
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.
For Outlook since the calendarId is for internal purposes we can only invite the primary email to calendar events. https://www.loom.com/share/60ac4ad245414714979dc2e11d8d347a?sid=6b089642-a97d-40cd-a015-37fc97a3e8d9
if (!credentialId) { | ||
// Keep this logic here for other events that need to fallback to other calendars | ||
if (eventCreationAttempts === 0) { | ||
const destinationCalendarCredentials = this.calendarCredentials.filter( | ||
(c) => c.type === destinationCalendar.integration | ||
); | ||
// It might not be the first connected calendar as it seems that the order is not guaranteed to be ascending of credentialId. | ||
const firstCalendarCredential = destinationCalendarCredentials[0] as | ||
| (typeof destinationCalendarCredentials)[number] | ||
| undefined; | ||
|
||
if (!firstCalendarCredential) { | ||
log.warn( | ||
"No other credentials found of the same type as the destination calendar. Falling back to first connected calendar" | ||
); | ||
await fallbackToFirstConnectedCalendar(); | ||
} else { | ||
log.warn( | ||
"No credentialId found for destination calendar, falling back to first found calendar of same type as destination calendar", | ||
safeStringify({ | ||
destination: getPiiFreeDestinationCalendar(destinationCalendar), | ||
firstConnectedCalendar: getPiiFreeCredential(firstCalendarCredential), | ||
}) | ||
); | ||
createdEvents.push(await createEvent(firstCalendarCredential, event)); | ||
eventCreated = true; | ||
break; |
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.
Not a huge fan of this approach but keeping this in here to maintain what we currently have.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
…thub.com/calcom/cal.com into fix-calendar-events-on-collective-events
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.
@joeauyeung I just tested creating an OAuthClient on the preview development and I can't click the Submit button at all
Ok. Tested again. Not sure what was going on but now I can submit successfully. |
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.
It's concerning to me that all this logic is changing and no automated tests are updated/added. We need to follow up ASAP with a PR adding unit tests to verify all of this logic.
* When inviting attendees to a calendar event, sometimes the external ID is only used for internal purposes | ||
* Need to process the correct external ID for the calendar service | ||
*/ | ||
const processExternalId = (destinationCalendar: DestinationCalendar) => { |
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 you think this function has the potential to grow in the number of "if" statements moving forward? i.e. We'll have to have different logic for a large number of different calendar apps. If so, we should move it off to its own file per calendar integration.
Since this is urgent to get fixed, that could be a follow-up refactor.
@keithwillcode there are 0 tests for the Regarding |
…th-clients/create.tsx
Co-authored-by: Omar López <zomars@me.com>
@@ -535,78 +535,105 @@ export default class EventManager { | |||
}; | |||
|
|||
if (event.destinationCalendar && event.destinationCalendar.length > 0) { | |||
// Since GCal pushes events to multiple calendars we only want to create one event per booking | |||
let gCalAdded = false; | |||
const destinationCalendars: DestinationCalendar[] = event.destinationCalendar.reduce( |
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.
Is the reduce refactor necessary to fix the bug? Or was it done for getting two birds with one stone?
If it's the latter then I'm afraid it is making the PR harder to review since it's not clear "where" is the bug that we're fixing.
Also as @keithwillcode mentioned we don't have EventManager tests to ship this PR with 100% confidence. RN if I approve this I'm not 100% confident this will not break other event type configurations.
My suggestion would be:
Make a PR with "only" the changes needed to fix the current bug. Then other PR for adding tests. Then other PR to do chores and refactoring.
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.
The refactor is necessary since ideally only one calendar event is created for the booking. When inviting team members it should add events to their default destination calendars by inviting those calendars to the event.
Since this is affecting collective events, a PR with "only" the fix would be to remove pushing multiple destination calendars when the event is a collective one. That would be the safest bet. Looking through the CalendarService
files of GCal and Outlook we already add team members as the attendees. Although for Outlook we still need to process the externalId
properly so all team members are added to the event.
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.
Yeah I think we should focus the rest of the day on getting tests wired up here and we ship this tomorrow.
This is the type of change that is high risk of making things worse than the original bug we are trying to fix.
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.
The tests should written against main and not against this code first to verify all existing logic stays the same. Once verified, we then add tests to verify this change in logic
Closing in favor of #14617 |
What does this PR do?
This PR aims to prevent attendees receiving multiple calendar invites by only creating one calendar event.
Fixes #14580 Fixes CAL-3412 Fixes CAL-3468
https://www.loom.com/share/89fecb968c9a4511869bfa807c273ca4
Requirement/Documentation
Type of change
How should this be tested?
Mandatory Tasks
Checklist