Skip to content

feat(settings): add delete organization in danger zone#3246

Open
rafavalls wants to merge 4 commits intomainfrom
rafavalls/delete-org-setting-2
Open

feat(settings): add delete organization in danger zone#3246
rafavalls wants to merge 4 commits intomainfrom
rafavalls/delete-org-setting-2

Conversation

@rafavalls
Copy link
Copy Markdown
Collaborator

What is this contribution about?

Adds a Danger Zone section to the Organization General settings page with a button to permanently delete the current organization. Uses the existing authClient.organization.delete() Better Auth method, shows a confirmation dialog before proceeding, and redirects to / on success.

Screenshots/Demonstration

A "Danger Zone" section appears at the bottom of Settings → Organization → General, with a red-bordered card and a destructive Delete button that opens a confirmation dialog.

How to Test

  1. Go to Settings → Organization → General
  2. Scroll to the bottom — a "Danger Zone" section should be visible
  3. Click Delete — a confirmation dialog should appear showing the org name
  4. Confirm deletion — the organization is deleted and you are redirected to /

Migration Notes

No migrations required.

Review Checklist

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

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

🧪 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 30, 2026

Release Options

Suggested: Minor (2.298.0) — based on feat: prefix

React with an emoji to override the release type:

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

Current version: 2.297.5

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

rafavalls and others added 3 commits May 4, 2026 11:28
…here

Replaces hard delete with an archive flag in org metadata. Archived orgs
are filtered from ORGANIZATION_LIST, blocked at the auth/routing layer in
context-factory and the UI router, and the onboarding redirect skips them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e redirect

- Add ArchivedOrgScreen so any URL under an archived org shows "Organization unavailable" instead of a broken shell
- shell-layout: detect archived orgs, render the screen, and clear the cached slug so /home doesn't bounce back
- shell-layout: skip persisting lastOrgSlug for archived orgs on setActive
- delete-organization-section: route through ORGANIZATION_DELETE MCP tool (the actual archive flow) instead of authClient.organization.delete (which would hard-delete and bypass the soft-delete logic)
- delete-organization-section: require typing the org name to confirm; on success, clear lastOrgSlug, drop the activeOrganization cache, and navigate to / so homeRoute redirects to the next active org or onboarding

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lete

ORGANIZATION_DELETE was changed to soft-delete via metadata.archived, but the
test still asserted the old deleteOrganization call path. Update the test to
assert updateOrganization is called with the archive metadata payload, and
that deleteOrganization is never called.

Co-Authored-By: Claude Opus 4.7 (1M context) <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