fix: gate stale invitation removal#4430
Open
nussann wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR narrows invitation hard deletion to stale invitations, aligning the organization invitation UI and server-side mutation with the requirement to delete only expired or canceled/non-pending invitations.
Changes:
- Adds a shared
canRemoveInvitationpredicate. - Enforces the removal guard in the organization router and includes invitation status in audit metadata.
- Updates the invitations table to hide hard removal for active pending invitations and require confirmation for removals.
- Adds unit coverage for the shared removal predicate.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
apps/dokploy/lib/invitations.ts |
Adds shared stale-invitation removal eligibility logic. |
apps/dokploy/server/api/routers/organization.ts |
Enforces server-side removal gating and augments audit metadata. |
apps/dokploy/components/dashboard/settings/users/show-invitations.tsx |
Updates available invitation actions and adds destructive confirmation/error handling. |
apps/dokploy/__test__/organization/invitations.test.ts |
Covers the removal predicate for expired, canceled, and active pending invitations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/claim #1413
What is this PR about?
This PR adds a focused stale-invitation cleanup slice for #1413. It restricts hard removal to expired or non-pending invitations, keeps active pending invitations on the cancel flow, enforces that guard server-side, adds a destructive confirmation/error handling in the Invitations table, and covers the shared removal predicate.
Checklist
canarybranch.Issues related
Related to #1413
Validation
corepack pnpm exec biome check apps/dokploy/lib/invitations.ts apps/dokploy/server/api/routers/organization.ts apps/dokploy/components/dashboard/settings/users/show-invitations.tsx apps/dokploy/__test__/organization/invitations.test.tscorepack pnpm --filter=dokploy exec vitest --config __test__/vitest.config.ts __test__/organization/invitations.test.ts --runcorepack pnpm --filter=dokploy run typecheckgit diff --checkLocal instance smoke test:
Copy InvitationandCancel InvitationRemove InvitationScreenshots / demo
Demo video: dokploy_1413_invitation_cleanup_demo_hq.mp4
Release asset page: PR #4430 demo video
The 12-second demo shows the local Invitations table flow: empty state, pending invitation, pending actions without hard removal, canceled invitation with removal available, destructive confirmation, and the empty state after removal.
Note
I noticed @manuelsampedro1 outlined a similar invitation-cleanup slice in the issue before this PR was opened. I do not want to race or displace active work; if they already have a PR in progress, I am happy to step back, close this, or collaborate.