Content
View differences
Updated by Kabiru Mwenja 2 days ago
Deleting a label in Administration > Labels removes it from every work package without a trace in the activity. Each affected work package should record the removal.
**Acceptance criteria**
* When an admin deletes a label that work packages carry, every affected work package gets an activity entry authored by that admin: "**Label removed** because the label '<name>' was deleted", together with the labels detail ("Labels: A, (deleted label)" to "A").
* The entries are written by a background job after the deletion; the admin is not kept waiting. Re-running the job adds no duplicate entries.
* Labels nobody uses (including the never-used inline labels removed nightly by COMMS-1050) produce no entries.
* The delete dialog mentions that the removal is recorded in each work package's activity.
**Technical notes**
* New journal cause `label_deleted` (`Journal::CausedByLabelDeletion`) carrying `label_id` and `label_name`, since the label row is gone when the journal is written; rendered through `OpenProject::JournalFormatter::Cause`.
* `Labels::DeleteService` collects the work package ids before destroying the label and enqueues `Labels::JournalizeDeletionJob`, which calls `Journals::CreateService` per work package under the work package mutex (no notifications).
* Depends on label journaling (COMMS-1022, PR #25320). Sibling of COMMS-1050 (PR #26187).
**Acceptance criteria**
* When an admin deletes a label that work packages carry, every affected work package gets an activity entry authored by that admin: "**Label removed** because the label '<name>' was deleted", together with the labels detail ("Labels: A, (deleted label)" to "A").
* The entries are written by a background job after the deletion; the admin is not kept waiting. Re-running the job adds no duplicate entries.
* Labels nobody uses (including the never-used inline labels removed nightly by COMMS-1050) produce no entries.
* The delete dialog mentions that the removal is recorded in each work package's activity.
**Technical notes**
* New journal cause `label_deleted` (`Journal::CausedByLabelDeletion`) carrying `label_id` and `label_name`, since the label row is gone when the journal is written; rendered through `OpenProject::JournalFormatter::Cause`.
* `Labels::DeleteService` collects the work package ids before destroying the label and enqueues `Labels::JournalizeDeletionJob`, which calls `Journals::CreateService` per work package under the work package mutex (no notifications).
* Depends on label journaling (COMMS-1022, PR #25320). Sibling of COMMS-1050 (PR #26187).