{{ message }}
Repository navigation
Conversation
…eted
Deleting an organization only soft deletes it: the row (and its permalink) is
kept until the hourly deletion task purges it. The web UI, however, hides it
immediately -- it disappears from the organization list, the header switcher
and every lookup (all scoped to `present`). That left an invisible squatter:
re-creating an organization with the same short name failed with "Short name
has already been taken" even though no conflicting organization was visible
anywhere, while the same name silently produced a suffixed permalink (acme-2).
Separate the two concerns so what the UI shows matches what the system
enforces:
* Organization#soft_destroy releases the permalink (moves it to a unique
`deleted-<uuid>` tombstone) before saving, so the short name is free again
the moment deletion completes and can be reused immediately.
* Permalink uniqueness and Organization.find_unique_permalink are scoped to
present (deleted_at: nil), so deleted organizations can never block or
perturb permalink generation again.
* The delete page explains the behaviour: the organization and its short name
go immediately; mail servers and data are purged in the background.
* The purge task logs the organization name, since the permalink is a
tombstone by the time that task runs.
Records are still retained until the background purge, so deleting stays
non-blocking, and stale deleted rows predating this change are ignored too.
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.

Summary
Fix organization deletion so the short name and permalink are released immediately instead of remaining reserved until the background purge.
What changed
Organization#soft_destroynow replaces the permalink with a uniquedeleted-<uuid>tombstone before saving.Organization.find_unique_permalinknow only consider present organizations (deleted_at: nil).Result
Deleting an organization immediately frees its short name for reuse. Re-creating it no longer fails because of an invisible deleted organization or receives an unnecessary permalink suffix.
Records are still retained until the background purge, so deletion remains non-blocking.