improvement(organization): invite validation experience#5008
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The org invite modal stops blocking current member emails and instead flags external collaborators and non-member pending invites with specific chip errors; team settings feed those lists separately from member re-invites. Workspace invitation emails and sending now support multiple workspace names in copy and subject lines. UI fixes: Reviewed by Cursor Bugbot for commit d539b53. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d539b53. Configure here.
Greptile SummaryThis PR improves the organization invite flow in three areas: existing org members can now receive workspace-only invitations for workspaces they lack (instead of being rejected outright), the invite modal surfaces more specific validation messages for external collaborators and pending invites, and a handful of input bugs are fixed across the invite modal and chat deploy email field.
Confidence Score: 4/5Safe to merge; the new batch invite path is well-tested and the stale-closure fixes are correct. One design gap in the workspace access check is worth a follow-up. The apps/sim/app/api/organizations/[id]/invitations/route.ts — the Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as OrganizationInviteModal
participant API as POST /organizations/[id]/invitations?batch=true
participant DB as Database
participant Email as sendInvitationEmail
UI->>API: emails[], workspaceInvitations[]
API->>DB: "validate workspace ownership & admin access"
API->>DB: query existing org members (member table)
API->>DB: query pending org invitations
note over API: split emails into newEmails / memberEmails
alt "isBatch && memberEmails.length > 0"
API->>DB: query permissions table (user x workspace)
API->>DB: query invitationWorkspaceGrant (pending workspace invites)
note over API: compute grantsNeeded per member
end
loop each email in emailsToInvite (org invite)
API->>DB: "createPendingInvitation (kind=organization)"
API->>Email: send org invitation email
end
loop each email in memberWorkspaceInvites (workspace-only invite)
API->>DB: "createPendingInvitation (kind=workspace)"
API->>Email: send workspace invitation email (multi-workspace names)
end
API-->>UI: "{ invitationsSent, invitedEmails, existingMembers, ... }"
Reviews (1): Last reviewed commit: "address comments" | Re-trigger Greptile |

Summary
Invite existing members to more workspaces: the org invite modal no longer rejects emails of current organization members — the batch invite API now sends them a single workspace invitation covering only the selected workspaces they don't already have access to (or a pending invite for), while new emails still get full org invitations. Workspace invitation emails now render multiple workspace names.
Clearer invite validation: external collaborators and already-pending emails are flagged on the chip with specific tooltip messages (including a pointer to the per-workspace Teammates tab for externals), duplicate workspace selections are deduped server-side, and inviting someone already covered returns an accurate error instead of a generic one.
Modal & input fixes: dropdowns inside modals are scrollable/selectable again (ChipDropdown switches to Radix modal behavior via the new InsideModalContext), and two paste bugs are fixed — rejected emails no longer render twice in the input, and pasting multiple emails no longer drops all but the last one (stale-closure fix in both the invite modal and chat deploy modal email fields).
Type of Change
Testing
Tested manually
Checklist