Skip to content

fix: gate stale invitation removal#4430

Open
nussann wants to merge 1 commit into
Dokploy:canaryfrom
nussann:codex/1413-invitation-cleanup
Open

fix: gate stale invitation removal#4430
nussann wants to merge 1 commit into
Dokploy:canaryfrom
nussann:codex/1413-invitation-cleanup

Conversation

@nussann
Copy link
Copy Markdown

@nussann nussann commented May 19, 2026

/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

  • I created a dedicated branch based on the canary branch.
  • I have read the suggestions in the CONTRIBUTING.md file.
  • I have tested this PR in my local instance.

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.ts
  • corepack pnpm --filter=dokploy exec vitest --config __test__/vitest.config.ts __test__/organization/invitations.test.ts --run
  • corepack pnpm --filter=dokploy run typecheck
  • git diff --check

Local instance smoke test:

  • created a fresh local Dokploy account
  • created a pending invitation and verified its action menu only showed Copy Invitation and Cancel Invitation
  • canceled that invitation and verified its action menu showed Remove Invitation
  • confirmed the destructive dialog and verified the invitation was removed from the table

Screenshots / 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.

@nussann nussann requested a review from Siumauricio as a code owner May 19, 2026 23:07
Copilot AI review requested due to automatic review settings May 19, 2026 23:07
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. pr-open labels May 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 canRemoveInvitation predicate.
  • 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.

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

Labels

🙋 Bounty claim pr-open size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants