Skip to content

fix(orgs): use runtime origin for booker URL fallback#28851

Open
ShipItAndPray wants to merge 1 commit intocalcom:mainfrom
ShipItAndPray:fix/28829-booker-url-runtime-origin
Open

fix(orgs): use runtime origin for booker URL fallback#28851
ShipItAndPray wants to merge 1 commit intocalcom:mainfrom
ShipItAndPray:fix/28829-booker-url-runtime-origin

Conversation

@ShipItAndPray
Copy link
Copy Markdown

Fixes #28829\n\nThe null-org fallback in getBookerBaseUrl/getTeamBookerUrl now uses the runtime webapp origin via getOrgFullOrigin(null) instead of WEBSITE_URL, so EU shard booking emails build reschedule/cancel links with app.cal.eu rather than cal.com.\n\nValidation:\n- corepack yarn vitest run packages/features/ee/organizations/lib/getBookerUrlServer.test.ts packages/features/ee/organizations/lib/orgDomains.test.ts\n- corepack yarn exec biome check packages/features/ee/organizations/lib/getBookerUrlServer.ts packages/features/ee/organizations/lib/getBookerUrlServer.test.ts\n- git diff --check

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added the 🐛 bug Something isn't working label Apr 12, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

📝 Walkthrough

Walkthrough

A new test suite for getBookerUrlServer was added to validate URL resolution behavior for organization booker pages. The implementation file was updated to explicitly annotate return types as Promise<string> for getBookerBaseUrl and getTeamBookerUrl functions. The fallback URL handling was modified to use getOrgFullOrigin(null) instead of the WEBSITE_URL constant, with the corresponding import statement replaced accordingly.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(orgs): use runtime origin for booker URL fallback' accurately describes the main change—replacing WEBSITE_URL with getOrgFullOrigin(null) for the booker URL fallback in org-related functions.
Description check ✅ Passed The PR description relates to the changeset, explaining the fix references issue #28829, describes the runtime origin change, and includes validation steps performed on the modified files.
Linked Issues check ✅ Passed The PR addresses the core requirement from #28829: using runtime origin (getOrgFullOrigin(null)) instead of hardcoded WEBSITE_URL ensures booker URLs resolve from the shard's origin, fixing reschedule/cancel links in system emails on app.cal.eu.
Out of Scope Changes check ✅ Passed The changes are focused and in-scope: updating getBookerBaseUrl and getTeamBookerUrl to use runtime origin, adding corresponding test coverage, with no unrelated modifications to other areas.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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.

🧹 Nitpick comments (1)
packages/features/ee/organizations/lib/getBookerUrlServer.test.ts (1)

31-35: Add a symmetric brand-domain test for getTeamBookerUrl.

getBookerBaseUrl has brand-domain coverage, but getTeamBookerUrl brand behavior is currently untested. Adding it would prevent regressions.

➕ Suggested test addition
   it("prefers the organization brand full domain when available", async () => {
     vi.mocked(getBrand).mockResolvedValueOnce({ fullDomain: "https://acme.cal.eu" } as never);

     await expect(getBookerBaseUrl(123)).resolves.toBe("https://acme.cal.eu");
   });
+
+  it("prefers the organization brand full domain for team URLs when available", async () => {
+    vi.mocked(getBrand).mockResolvedValueOnce({ fullDomain: "https://acme.cal.eu" } as never);
+
+    await expect(getTeamBookerUrl({ organizationId: 123 })).resolves.toBe("https://acme.cal.eu");
+  });
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/features/ee/organizations/lib/getBookerUrlServer.test.ts` around
lines 31 - 35, Add a symmetric unit test that verifies getTeamBookerUrl prefers
the organization brand fullDomain like the existing getBookerBaseUrl test: mock
getBrand (vi.mocked(getBrand).mockResolvedValueOnce({ fullDomain:
"https://acme.cal.eu" } as never)) and assert await
expect(getTeamBookerUrl(123)).resolves.toBe("https://acme.cal.eu"); name the
test something like "getTeamBookerUrl prefers the organization brand full domain
when available" so it mirrors the getBookerBaseUrl coverage and prevents
regression.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/features/ee/organizations/lib/getBookerUrlServer.test.ts`:
- Around line 31-35: Add a symmetric unit test that verifies getTeamBookerUrl
prefers the organization brand fullDomain like the existing getBookerBaseUrl
test: mock getBrand (vi.mocked(getBrand).mockResolvedValueOnce({ fullDomain:
"https://acme.cal.eu" } as never)) and assert await
expect(getTeamBookerUrl(123)).resolves.toBe("https://acme.cal.eu"); name the
test something like "getTeamBookerUrl prefers the organization brand full domain
when available" so it mirrors the getBookerBaseUrl coverage and prevents
regression.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 37b6d7df-e4b1-4bdd-9cba-477d64f711ca

📥 Commits

Reviewing files that changed from the base of the PR and between d08f4a0 and fd7930f.

📒 Files selected for processing (2)
  • packages/features/ee/organizations/lib/getBookerUrlServer.test.ts
  • packages/features/ee/organizations/lib/getBookerUrlServer.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] System booking emails generate reschedule/cancel links with cal.com TLD instead of cal.eu on app.cal.eu instance

3 participants