This PR is part of a stack, managed by mrge:
What does this PR do?
- Fixes #11953
- /claim #11953
- Adds support for selecting multiple hosts in round-robin event types.
- Modifies
getLuckyUser to return either a single host (if multipleRoundRobinHosts is not specified or is 1) or multiple hosts (if multipleRoundRobinHosts > 1).
- Updates the event type metadata schema (
EventType.metadata) to include multipleRoundRobinHosts.
- Adds comprehensive test coverage for multiple host selection scenarios.
- Enhances the booking flow so that multiple hosts can be assigned to a single booking if configured.
Mandatory Tasks (DO NOT REMOVE)
- I have self-reviewed the code (A decent size PR without self-review might be rejected).
- I have updated the developer docs in
/docs if this PR makes changes that would require a [documentation change](https://cal.com/docs). (If N/A, check this box and write “N/A” here.) N/A
- I confirm automated tests are in place that prove my fix is effective or that my feature works.
How should this be tested?
- Setup: Pull this branch and run any necessary migrations.
- Create or edit an Event Type:
- Under the “Round Robin” settings, ensure there are no fixed hosts.
- Add multiple users as round-robin hosts.
- In the
EventType.metadata, set multipleRoundRobinHosts to the desired number (e.g., 2 or 3).
- Book an Event:
- Book the event as a normal user and confirm that multiple hosts are indeed selected.
- Verify in the database or in the logs that the expected hosts are assigned to the booking.
- Check Calendar/Email/Webhook (if enabled):
- Each of the assigned hosts should receive notification (and appear as attendees if your configuration supports that).
- Any configured webhooks should fire as usual, including references to all selected hosts.
No additional environment variables are required for this feature.
Checklist
- My code follows the style guidelines of this project.
- I have performed a self-review of my own code.
- I have commented my code, particularly in hard-to-understand areas.
- I have verified that the changes generate no new warnings.
- New and existing unit tests pass locally with my changes.