CRM · Customer deletion with unsubscribe notice

Deletes a customer record and, unless the operator opts out, posts to users_unsubscribe_send so the person receives an unsubscribe/erasure notification.

AreaCRM
Routescrm.users.index
Centre modulescrm
Staff levelsroot · admin · manager
Modelsuser
UI labeldelete
Coverage2 use cases · 1 happy · 3 failure

Known issues (1)

How it works

sendRemoveEmail defaults to true and is reset to true in finally, so the opt-out is per-deletion rather than sticky. The notification is a raw fetch to /api/v4/users_unsubscribe_send with the bearer token — fire-and-forget, with no .then/.catch, so its outcome is invisible to the operator. Deletion itself goes through destroyRecord().

Use cases

Why someone opens this (2)

  • Honouring a GDPR erasure request and confirming it to the customer by email.
  • Removing a duplicate or test registration without emailing anyone (opt-out ticked).

Path map

flowchart LR
    F(["Customer deletion with unsubscribe notice"]):::feat
    F --> H1["Delete and notify"]:::ok
    F -.-> X1["Invalid model"]:::bad
    F -.-> X2["Delete rejected by the API"]:::bad
    F -.-> X3["Unsubscribe email never sent"]:::bad
    classDef feat fill:#157068,stroke:#157068,color:#ffffff,font-weight:bold
    classDef ok fill:#e3f1ea,stroke:#0d6b42,color:#0d4a2e
    classDef bad fill:#f7e6e2,stroke:#9a2d1c,color:#6e1f13

Happy paths

Delete and notify

  1. Operator clicks delete on a row and confirms in the deletion modal.
  2. destroyRecord() removes the customer.
  3. Because sendRemoveEmail is true, an unsubscribe notification is posted for that user id.
  4. The flag resets to true for the next deletion.

Failure paths

QA checklist

Tick these off while regression-testing this feature. The boxes are plain Markdown, so progress is visible in git diffs.

  • ✅ Delete and notify
  • ⛔ Invalid model
  • ⛔ Delete rejected by the API
  • ⛔ Unsubscribe email never sent

Implementation


Generated from doc/feature-inventory.json · id crm-customer-delete · commit 276788ca6