Skip to content

fix: join multiple username parameter with + in Booker atom instead of ,#23203

Merged
ibex088 merged 4 commits intocalcom:mainfrom
sahitya-chandra:cal-6280
Aug 25, 2025
Merged

fix: join multiple username parameter with + in Booker atom instead of ,#23203
ibex088 merged 4 commits intocalcom:mainfrom
sahitya-chandra:cal-6280

Conversation

@sahitya-chandra
Copy link
Member

What does this PR do?

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

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. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

@sahitya-chandra sahitya-chandra requested a review from a team August 20, 2025 03:59
@sahitya-chandra sahitya-chandra requested a review from a team as a code owner August 20, 2025 03:59
@vercel
Copy link

vercel bot commented Aug 20, 2025

@sahitya-chandra is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Aug 20, 2025
@graphite-app graphite-app bot requested a review from a team August 20, 2025 03:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

Walkthrough

The change updates the username query parameter serialization in packages/platform/atoms/hooks/event-types/public/useAtomGetPublicEvent.tsx for the get-public-event API call. When multiple usernames are provided, they are now joined with plus (+) separators instead of commas (,). No other logic in parameter construction, orgId handling, request execution, or response handling was modified. No public/exported API signatures changed.

Assessment against linked issues

Objective Addressed Explanation
Use + as the separator for multiple usernames in the get-public-event query string to prevent conversion to commas and enable dynamic group bookings ([#23202, CAL-6280])

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added booking-page area: booking page, public booking page, booker 🐛 bug Something isn't working labels Aug 20, 2025
@graphite-app
Copy link

graphite-app bot commented Aug 20, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/20/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add community label" took an action on this PR • (08/20/25)

1 label was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (08/21/25)

1 label was added to this PR based on Keith Williams's automation.

@dosubot dosubot bot added the platform Anything related to our platform plan label Aug 20, 2025
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: 0

🧹 Nitpick comments (3)
packages/platform/atoms/hooks/event-types/public/useAtomGetPublicEvent.tsx (3)

27-30: Avoid recomputing username list; compute once and reuse

Precompute usernameList with useMemo and reuse it for both isDynamic and the request param. Reduces duplication and keeps logic consistent.

 import { useMemo } from "react";
@@
-export const useAtomGetPublicEvent = ({ username, eventSlug, isTeamEvent, teamId, selectedDuration }: Props) => {
+export const useAtomGetPublicEvent = ({ username, eventSlug, isTeamEvent, teamId, selectedDuration }: Props) => {
@@
-  const isDynamic = useMemo(() => {
-    return getUsernameList(username ?? "").length > 1;
-  }, [username]);
+  const usernameList = useMemo(() => getUsernameList(username ?? ""), [username]);
+  const isDynamic = useMemo(() => usernameList.length > 1, [usernameList]);
@@
-      const params: Record<string, any> = {
+      const params: Record<string, any> = {
         isTeamEvent,
         teamId,
-        username: getUsernameList(username ?? "").join("+")
+        username: usernameList.join("+")
       };

Also applies to: 39-40


42-45: Nit: avoid leaking undefined orgId into params

If organizationId can be undefined, the current check may include orgId=undefined. Guard by type.

-      if (organizationId !== 0) {
-        params.orgId = organizationId;
-      }
+      if (typeof organizationId === "number" && organizationId !== 0) {
+        params.orgId = organizationId;
+      }

33-63: Add a focused test to prevent regressions on '+' delimiter

A small test that renders the hook and asserts the outgoing params include username joined by + will lock this down.

Example (paths may need minor adjustments to your test setup):

// packages/platform/atoms/hooks/event-types/public/__tests__/useAtomGetPublicEvent.test.tsx
import { renderHook } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import http from "../../../lib/http";
import { useAtomGetPublicEvent } from "../useAtomGetPublicEvent";

jest.mock("../../../lib/http", () => ({
  __esModule: true,
  default: { get: jest.fn().mockResolvedValue({ data: { status: "success", data: { length: 30 } } }) },
}));

const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => {
  const qc = new QueryClient();
  return <QueryClientProvider client={qc}>{children}</QueryClientProvider>;
};

it("joins usernames with '+' in request params", async () => {
  const spy = jest.spyOn(http, "get");
  renderHook(
    () =>
      useAtomGetPublicEvent({
        username: "alice+bob",
        eventSlug: "standup",
        selectedDuration: 45,
      } as any),
    { wrapper }
  );
  // wait for first call
  await new Promise((r) => setTimeout(r, 0));

  expect(spy).toHaveBeenCalled();
  const [, { params }] = spy.mock.calls[0];
  expect(params.username).toBe("alice+bob"); // serializer should encode '+' to %2B on the wire
});

If you want, I can open a follow-up PR adding this test and wiring any missing providers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 67af8b4 and ffa98d4.

📒 Files selected for processing (1)
  • packages/platform/atoms/hooks/event-types/public/useAtomGetPublicEvent.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • packages/platform/atoms/hooks/event-types/public/useAtomGetPublicEvent.tsx
**/*.{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/platform/atoms/hooks/event-types/public/useAtomGetPublicEvent.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
packages/platform/atoms/hooks/event-types/public/useAtomGetPublicEvent.tsx (2)

39-40: Use '+' to join usernames — aligns with API contract for dynamic group bookings

Switching to join("+") fixes the 404s by matching the expected username=alice+bob format.


47-49: Default axios serializer percent-encodes “+” as “%2B”

Verified that in packages/platform/atoms/lib/http.ts we create an Axios instance without any custom paramsSerializer. Axios’s built-in buildURL logic uses encodeURIComponent, which encodes “+” to “%2B”. The server’s split on “+” will therefore receive “alice%2Bbob”, decoding back to “alice+bob” correctly. No changes required.

@kart1ka
Copy link
Contributor

kart1ka commented Aug 20, 2025

@sahitya-chandra Could you please attach a loom video showing that this fix works?

Copy link
Contributor

@Ryukemeister Ryukemeister left a comment

Choose a reason for hiding this comment

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

need to test it in local first before approving, this could cause an issue with usernames for managed users (for platform)

Copy link
Contributor

@ibex088 ibex088 left a comment

Choose a reason for hiding this comment

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

LGTM
thanks for the PR, @sahitya-chandra

@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2025

E2E results are ready!

@ibex088 ibex088 merged commit 58930c4 into calcom:main Aug 25, 2025
34 of 38 checks passed
@sahitya-chandra sahitya-chandra deleted the cal-6280 branch August 25, 2025 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

booking-page area: booking page, public booking page, booker 🐛 bug Something isn't working community Created by Linear-GitHub Sync platform Anything related to our platform plan ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Booker atom incorrectly converts + to , in username parameter for dynamic group bookings API calls

5 participants