Skip to content

Allow admins to archive or delete safety violations from the admin page #988

Description

@paullizer

Summary

Admins need a way to remove safety violation records from the active Safety Violations admin queue by archiving them, and where appropriate, permanently deleting them from the admin page.

User Value

Safety violation admins can keep the review queue clean after remediation, reduce noise in operational dashboards, and remove records that should no longer be retained in the active admin workflow.

Proposed Behavior

  • Add archive controls to the Safety Violations admin page for authorized safety violation admins.
  • Archived violations should be hidden from the default active queue, stats, and export results unless the admin explicitly filters for archived records.
  • Provide an archived-record view/filter so admins can audit archived violations and, if supported by the implementation, restore them to the active queue.
  • Add a separate permanent delete action only behind an explicit confirmation flow, with clear destructive wording.
  • Ensure archive/delete actions refresh the list, cards, stats, pagination, and CSV export behavior consistently.
  • Preserve authorization boundaries: only authenticated users who satisfy the SafetyViolationAdmin admin page requirements should be able to archive or delete records.

Acceptance Criteria

  • The admin Safety Violations page exposes archive/delete actions from the list/card/detail workflow without affecting the user-facing “My Safety Violations” profile tab unexpectedly.
  • Archiving a violation records who archived it and when, hides it from the default admin queue, and allows admins to filter/view archived records.
  • Permanent deletion requires an explicit confirmation and removes the violation record from storage only after server-side authorization succeeds.
  • Backend routes for archive/delete are protected with the existing Swagger, login, SafetyViolationAdmin, and content-safety-enabled decorators.
  • Stats, pagination, and CSV export use the same archived/default filtering semantics as the visible admin table.
  • Unauthorized users cannot archive or delete safety violations.
  • Functional tests cover archive behavior, delete authorization/confirmation contract, and admin UI control presence.

Notes

Relevant current implementation surface:

  • application/single_app/route_frontend_safety.py renders /admin/safety_violations.
  • application/single_app/route_backend_safety.py currently supports list, stats, export, and PATCH review updates for safety logs.
  • application/single_app/templates/admin_safety_violations.html contains the admin page table, cards, filters, and review modal.
  • application/single_app/static/js/admin/admin-safety-violations.js renders the admin list/card views and saves review changes.
  • Current statuses are New, In-Review, Resolved, and Dismissed; archive should probably be represented separately from remediation status so existing status semantics stay intact.

Duplicate search performed with: "safety violation" admin archive delete; no matching issues were found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Pending Evaluation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions