Skip to content

Comments

fix: Calendar invite owner not updating after round robin reassignment#24474

Merged
ibex088 merged 4 commits intomainfrom
somay/cal-6547-bug-calendar-invite-owner-not-updating-after-reassignment
Oct 16, 2025
Merged

fix: Calendar invite owner not updating after round robin reassignment#24474
ibex088 merged 4 commits intomainfrom
somay/cal-6547-bug-calendar-invite-owner-not-updating-after-reassignment

Conversation

@ibex088
Copy link
Contributor

@ibex088 ibex088 commented Oct 15, 2025

What does this PR do?

Before

  • The round robin event is booked with Host A.
  • Reassignment to Host B: You call the endpoint Reassign a Booking to a Specific Host, which successfully reassigns the event to Host B. This action removes the event from Host A's calendar and adds it to Host B's calendar.
  • Reassignment Back to Host A: However, when the event is reassigned back to Host A, it is removed from Host B's calendar but is not added back to Host A's calendar.

https://www.loom.com/share/7cbd8f110a2f41e79d74923115443e13?sid=fe47015e-66d9-4db4-b22c-6102bf51bd8c

After

https://www.loom.com/share/5ab28e81dbfa418cbc01b4bd72ec17f2?sid=2b80048b-4d98-4b82-bbca-2461d4e6855c

@linear
Copy link

linear bot commented Oct 15, 2025

@graphite-app graphite-app bot requested a review from a team October 15, 2025 11:31
@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Oct 15, 2025
@graphite-app graphite-app bot requested a review from a team October 15, 2025 11:31
@dosubot dosubot bot added teams area: teams, round robin, collective, managed event-types 🐛 bug Something isn't working labels Oct 15, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Walkthrough

Updates in packages/features/ee/round-robin/roundRobinManualReassignment.ts and roundRobinReassignment.ts add a conditional branch for organizer changes (hasOrganizerChanged). When true, the constructed event object (evt) has videoCallData and iCalUID cleared before proceeding. This change adjusts event construction for reassignment scenarios involving a new organizer to avoid identifier/location conflicts during subsequent create/update operations. No exported/public API signatures were modified.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely describes the main change, indicating a fix to ensure the calendar invite owner is updated following a round-robin reassignment, which matches the implemented code logic.
Linked Issues Check ✅ Passed The code introduces a guard for when the organizer changes and clears videoCallData and iCalUID so that the calendar invite is recreated under the new host, which directly addresses the requirement that the invite owner update after reassignment in CAL-6547.
Out of Scope Changes Check ✅ Passed All modifications are focused on handling organizer changes during round-robin reassignment by clearing relevant event identifiers, and there are no unrelated or extraneous code changes outside this scope.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The pull request description clearly states the problem being fixed and references the relevant GitHub and Linear issue numbers, and it describes the before and after behavior for round-robin reassignment and calendar invite ownership. It directly relates to the code changes and is not off-topic or generic. Therefore the description meets the criteria for adequacy.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch somay/cal-6547-bug-calendar-invite-owner-not-updating-after-reassignment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/features/ee/round-robin/roundRobinManualReassignment.ts (1)

315-320: Code duplication addressed in roundRobinReassignment.ts review.

This code block is identical to the one in roundRobinReassignment.ts (lines 344-349). See the review comment in that file for the suggested refactor to extract this into a shared utility function.

Minor note: The formatting here has extra spaces (if( hasOrganizerChanged )) while the other file is missing the space after if. Both should be standardized to if (hasOrganizerChanged) when refactoring.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3076aca and ebb5dc3.

📒 Files selected for processing (2)
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts (2 hunks)
  • packages/features/ee/round-robin/roundRobinReassignment.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinReassignment.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinReassignment.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinReassignment.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: anglerfishlyy
PR: calcom/cal.com#0
File: :0-0
Timestamp: 2025-08-27T16:39:38.192Z
Learning: anglerfishlyy successfully implemented CAL-3076 email invitation feature for Cal.com team event-types in PR #23312. The feature allows inviting people via email directly from assignment flow, with automatic team invitation if email doesn't belong to existing team member. Implementation includes Host type modifications (userId?: number, email?: string, isPending?: boolean), CheckedTeamSelect component updates with CreatableSelect, TRPC schema validation with zod email validation, and integration with existing teamInvite system.
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
packages/features/ee/round-robin/roundRobinReassignment.ts (1)

344-349: No action required — downstream handles undefined iCalUID.

EventManager.reschedule creates new calendar events when the organizer changes (it calls this.create(originalEvt)), EventManager.create/createAllCalendarEvents populate iCalUID from created results, and handleRescheduleEventManager reconciles evt.iCalUID from the calendar results and updates the booking in the DB (see EventManager.reschedule/create/createAllCalendarEvents in packages/features/bookings/lib/EventManager.ts and the iCalUID assignment + prisma update in packages/features/ee/round-robin/handleRescheduleEventManager.ts).

conferenceCredentialId: conferenceCredentialId ?? undefined,
};

if( hasOrganizerChanged ){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have this similar logic in handleNewBooking, which we somehow skipped in the roundRobinManualReassignment and roundRobinReassignment

@github-actions github-actions bot added enterprise area: enterprise, audit log, organisation, SAML, SSO reactive⚡︎ 🚨 urgent Created by Linear-GitHub Sync labels Oct 15, 2025
@vercel
Copy link

vercel bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Oct 16, 2025 6:33am
cal-eu Ignored Ignored Oct 16, 2025 6:33am

Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

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

Looks good

@github-actions
Copy link
Contributor

E2E results are ready!

@ibex088 ibex088 merged commit 9afdb1a into main Oct 16, 2025
37 of 38 checks passed
@ibex088 ibex088 deleted the somay/cal-6547-bug-calendar-invite-owner-not-updating-after-reassignment branch October 16, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO platform Anything related to our platform plan reactive⚡︎ ready-for-e2e size/S teams area: teams, round robin, collective, managed event-types 🚨 urgent Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Calendar invite owner not updating after reassignment

3 participants