HOLD: Gate person deletion on associated records - #2078
Draft
maebeale wants to merge 4 commits into
Draft
Conversation
A person who was a payer, scholarship recipient, or grant donor could still be deleted whenever they had no user, affiliations, or authored content — the destroy gate ignored money entirely — cascade-destroying or orphaning that financial history. Fold the checks into a Person#deletable? source of truth, have the policy delegate to it, and surface a "Can't be deleted — …" reason on the edit form (mirroring the EventRegistration pattern) instead of silently hiding the button. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend the person delete gate to event registrations that carry payments
(allocations) and event staff assignments, and refactor the checks into a
single Person#deletion_blockers key list. The edit-form notice now names the
actual kinds of records the person has ("...has authored stories, payments,
and grants.") instead of lumping them under generic categories.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale
marked this pull request as ready for review
August 4, 2026 02:00
Any event registration (paid or not) and any form submission now blocks person deletion, alongside event staffing — this history is worth keeping, and the Delete button is only for cleaning up records with no associations at all. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When a person's user authored workshop logs, story ideas, workshop ideas, or workshop variation ideas, name them in the "Can't be deleted" notice rather than only the generic user-account reason. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale
marked this pull request as draft
August 4, 2026 03:19
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.
🤖 suggested review level: 3 Read 📖 contained gating change on one policy/model/decorator + a form branch
What is the goal of this PR and why is this important?
How did you approach the change?
Person#deletion_blockersis the single source of truth — a keyed list of every record kind that blocks deletion: user account, user-authored workshop logs / story ideas / workshop ideas / workshop variation ideas, affiliations, authored stories/workshops/workshop variations/community news/resources, payments, scholarships, grants, event registrations, event staff assignments, and form submissions.deletable?is just "no blockers".PersonPolicy#destroy?delegates to it (dropped the policy-localhas_associated_data?).PersonDecorator#deletion_blocked_reasonmaps those keys to labels, so the edit form names the actual kinds the person has — e.g. "Can't be deleted — this person has a user account, authored workshop logs, and event registrations." — instead of silently hiding the Delete button.has_many :payments(restrict_with_errorbackstop).Anything else to add?