Skip to content

fix(invite): fix invite email styling, org redirect, and no-access UX#3072

Open
rafavalls wants to merge 2 commits intomainfrom
valls/deco-4006-invite-email-e-redirect-ir-para-org-certa
Open

fix(invite): fix invite email styling, org redirect, and no-access UX#3072
rafavalls wants to merge 2 commits intomainfrom
valls/deco-4006-invite-email-e-redirect-ir-para-org-certa

Conversation

@rafavalls
Copy link
Copy Markdown
Collaborator

@rafavalls rafavalls commented Apr 8, 2026

What is this contribution about?

Fixes multiple regressions in the organization invite flow (DECO-4006):

  1. Email template: Replaced bare unstyled HTML with a proper inline-CSS table layout. Also escapes HTML entities in org name and inviter name to prevent XSS, and URL-encodes query params in the accept URL.
  2. Wrong org redirect after acceptance: The email link's redirectTo now points to /${orgSlug} instead of /, so clicking Accept lands the user directly on the correct org instead of their cached personal org.
  3. Infinite loading when visiting org without access: setActive returning null now shows an "Access denied" EmptyState with a clear message ("Check your email for an invitation") and a button that clears the stale lastOrgSlug from localStorage before navigating home — preventing a redirect loop.
  4. Personal org after inbox acceptance: Restored correct toast ordering (success shown only after all async ops complete), and added an org list fallback when setActive doesn't return a slug.

Screenshots/Demonstration

UI changes are in the "Access denied" empty state (shell-layout) and the invite email template. No screenshot available in this environment.

How to Test

  1. Invite a user to an org via the Members page — verify the email looks styled and the accept link contains the org slug in redirectTo.
  2. Click the email link as a logged-in user → accept → confirm you land on the invited org, not your personal one.
  3. Visit /<org-slug> for an org you're not a member of → confirm you see "Access denied" with a "Go to your account" button instead of an infinite spinner.
  4. Accept an invitation from the Inbox popover → confirm toast fires only after completion and you're redirected to the correct org.

Migration Notes

No database migrations required.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Fixes regressions in the org invite flow: styled invite emails, correct org redirect, and a clear “Access denied” screen. Addresses DECO-4006.

  • Bug Fixes
    • Invite email: inline‑styled table layout; escape org/inviter names; URL‑encode invitationId and org slug in redirectTo.
    • Redirect: accept link sets redirectTo to /${orgSlug} so users land in the invited org.
    • No access: show “Access denied” EmptyState; button clears stale lastOrgSlug and returns home.
    • Inbox acceptance: show success toast after async steps; fall back to org list when setActive returns no slug before redirect.

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

- Improve invite email HTML with proper inline styles and table layout
- Use org slug in redirectTo so acceptance redirects to the correct org
- Escape HTML entities in email to prevent XSS (org name, inviter name)
- URL-encode invitationId and orgSlug in the accept URL
- Show "Access denied" EmptyState instead of infinite splash when user
  lacks access to an org; clear stale lastOrgSlug before redirecting
- Restore correct toast ordering in inbox accept flow (after all async)
- Add org list fallback when setActive doesn't return slug (#4006)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Release Options

Suggested: Patch (2.252.1) — based on fix: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.252.1-alpha.1
🎉 Patch 2.252.1
❤️ Minor 2.253.0
🚀 Major 3.0.0

Current version: 2.252.0

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

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

No issues found across 4 files

…e-email-e-redirect-ir-para-org-certa

Co-Authored-By: Claude Sonnet 4.6 <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.

1 participant