Skip to content

feat: redirect sub domain for orgs to verified custom domain when present#27934

Open
Amit91848 wants to merge 1 commit intofeat/custom-org-domains-rebasedfrom
feat/org_subdomains_internal_redirects
Open

feat: redirect sub domain for orgs to verified custom domain when present#27934
Amit91848 wants to merge 1 commit intofeat/custom-org-domains-rebasedfrom
feat/org_subdomains_internal_redirects

Conversation

@Amit91848
Copy link
Member

@Amit91848 Amit91848 commented Feb 13, 2026

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

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
  • My PR is too large (>500 lines or >10 files) and should be split into smaller PRs

Summary by cubic

Redirect org subdomains to their verified custom domains on public booking pages, preserving path and query. Applies across user, team, forms, and instant meeting routes and skips embeds.

  • New Features
    • Added buildCustomDomainRedirect utility with unit tests (301 redirect, preserves query string).
    • Implemented redirects in SSR for user (single/group), team (profile/event), routing forms, and instant meeting pages.
    • Redirect triggers only on valid org subdomains when a verified custom domain exists and the request is not an embed.
    • Extended data queries to include verified customDomain.slug for orgs and teams.

Written for commit 8731078. Summary will update on new commits.

Copy link
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app graphite-app bot added the core area: core, team members only label Feb 13, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 9 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/lib/team/[slug]/getServerSideProps.tsx">

<violation number="1" location="apps/web/lib/team/[slug]/getServerSideProps.tsx:157">
P2: `team.customDomain?.slug` is always undefined because getTeamWithMembers doesn’t select the team’s customDomain. This prevents org pages from redirecting to their verified custom domain. Select the org’s verified customDomain in getTeamWithMembers (or use a verified-domain helper) before relying on it here.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


const isEmbed = context.resolvedUrl?.includes("/embed");
if (!isEmbed && isValidOrgDomain && !customDomain) {
const orgCustomDomainSlug = team.isOrganization
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 13, 2026

Choose a reason for hiding this comment

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

P2: team.customDomain?.slug is always undefined because getTeamWithMembers doesn’t select the team’s customDomain. This prevents org pages from redirecting to their verified custom domain. Select the org’s verified customDomain in getTeamWithMembers (or use a verified-domain helper) before relying on it here.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/lib/team/[slug]/getServerSideProps.tsx, line 157:

<comment>`team.customDomain?.slug` is always undefined because getTeamWithMembers doesn’t select the team’s customDomain. This prevents org pages from redirecting to their verified custom domain. Select the org’s verified customDomain in getTeamWithMembers (or use a verified-domain helper) before relying on it here.</comment>

<file context>
@@ -151,6 +152,22 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
 
+  const isEmbed = context.resolvedUrl?.includes("/embed");
+  if (!isEmbed && isValidOrgDomain && !customDomain) {
+    const orgCustomDomainSlug = team.isOrganization
+      ? team.customDomain?.slug
+      : team.parent?.customDomain?.slug;
</file context>
Fix with Cubic

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

@devin-ai-integration
Copy link
Contributor

Reviewed the Cubic AI feedback on this PR. The only issue raised (violation #1 regarding team.customDomain?.slug being undefined) has a confidence score of 7/10, which is below the 9/10 threshold for automated fixes. Skipping this issue — no changes made.

Link to Devin run

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

Labels

core area: core, team members only size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant