Skip to content

HOLD: Gate person deletion on associated records - #2078

Draft
maebeale wants to merge 4 commits into
mainfrom
maebeale/gate-person-delete-button
Draft

HOLD: Gate person deletion on associated records#2078
maebeale wants to merge 4 commits into
mainfrom
maebeale/gate-person-delete-button

Conversation

@maebeale

@maebeale maebeale commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

🤖 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?

  • A person could be deleted while still holding records worth keeping — the destroy gate only checked user / affiliations / authored content, ignoring money and event history entirely. Deleting cascade-destroyed or orphaned that data. The Delete button is meant only for cleaning up person records with no real associations.

How did you approach the change?

  • Person#deletion_blockers is 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-local has_associated_data?).
  • PersonDecorator#deletion_blocked_reason maps 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.
  • Added has_many :payments (restrict_with_error backstop).

Anything else to add?

  • The workshop-log/idea records hang off the person's user (created_by), so they only appear on a person who already has a user account — they add specificity to the notice.
  • Still deletable (disposable profile detail only): addresses, contact methods, tags/sectors, bookmarks, comments, notifications, professional licenses, avatar.
  • Specs cover policy, model, and decorator (per-kind + combined messages).

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>
Copilot AI review requested due to automatic review settings August 4, 2026 01:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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>
Copilot AI review requested due to automatic review settings August 4, 2026 01:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale
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>
Copilot AI review requested due to automatic review settings August 4, 2026 02:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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>
Copilot AI review requested due to automatic review settings August 4, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale
maebeale marked this pull request as draft August 4, 2026 03:19
@maebeale maebeale changed the title Gate person deletion on financial records HOLD: Gate person deletion on associated records Aug 4, 2026
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.

2 participants