Skip to content

Land newly-signed-up invited users in the invited org#2976

Draft
ignaciojimenezr wants to merge 4 commits into
mainfrom
feat/invite-email-deeplink-to-org
Draft

Land newly-signed-up invited users in the invited org#2976
ignaciojimenezr wants to merge 4 commits into
mainfrom
feat/invite-email-deeplink-to-org

Conversation

@ignaciojimenezr

@ignaciojimenezr ignaciojimenezr commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Pairs with the backend change (mcpjam-backend#652). When a brand-new user signs up from an org invite, they used to land in their own auto-created personal org instead of the org they were invited to. This drops them into the right one.

  • The signup invite email now links to /?invite_org={id} (backend PR). This captures that id at boot — before the WorkOS redirect drops the URL — stashes it, and strips it from the URL.
  • After signup, once the user is authenticated and actually a member of that org, it's set as their active org (then the stash is cleared so it only fires once).
  • Safe fallback: if they're not a member yet (e.g. a paid seat still pending), nothing happens and the stash waits for a later load. No effect on existing users.

Reuses the existing active-org machinery — no routing or auth changes.

Draft / do not merge — needs the backend PR first, and wants a quick test in the WorkOS signup flow.

🤖 Generated with Claude Code


Summary by cubic

Newly signed-up invited users now land in the org they were invited to, with a one-click “Switch organization” prompt once membership is confirmed. Signed-out users hitting invite links or org routes are guided through the right auth flow and returned to the org.

  • New Features

    • Capture ?invite_org at boot, stash a return-path marker in sessionStorage, and strip it from the URL.
    • Signed out on an invite link: start WorkOS sign-up; signed out on an org route: start sign-in and stash the org return path.
    • OAuth callback restores the invite/org return path only after the Convex user is real (not guest) and linked to the WorkOS user, then clears the marker.
    • If membership is pending, show a one-per-session info toast; once confirmed, show a success toast with “Switch organization” (no auto-switch).
    • In ShareProjectDialog, show a clear toast when an invite requires paid seat payment.
  • Dependencies

    • Requires backend invite emails to include ?invite_org={id}.

Written for commit 7f0cfee. Summary will update on new commits.

Review in cubic

When a brand-new user signs up from an org invite email, they'd land in
their own auto-created personal org instead of the org they were invited
to. The signup email now carries `?invite_org={id}`; capture it at boot
(before the WorkOS redirect drops the URL), then set it active once the
user is authenticated and a confirmed member.

- new lib/pending-invite-org.ts: capture/read/clear the stashed org id
- main.tsx: capture `?invite_org` at boot
- use-app-state.ts: apply it once the user is a member, then clear it

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chelojimenez

chelojimenez commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@ignaciojimenezr ignaciojimenezr changed the title [DO NOT MERGE] Land newly-signed-up invited users in the invited org Land newly-signed-up invited users in the invited org Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Internal preview

Preview URL: https://mcp-inspector-pr-2976.up.railway.app
Deployed commit: 1454ee9
PR head commit: 7f0cfee
Backend target: staging fallback.
Health: ✅ Convex reachable
Access is employee-only in non-production environments.

Rather than silently force the active org, notify the invited user and let
them choose:
- not a member yet (e.g. paid team seat still resolving): a one-per-session
  info toast that they'll get access once their seat is set up
- once they're a member: a success toast with a "Switch organization" action
  that switches them in on click

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants