Repository navigation
Description
Summary
Selecting opportunities on the Content page offers three bulk actions — send to webhook, mark done, dismiss — and no way to remove them. Dismissing hides a row behind a status filter but the row stays, so a brand carrying hundreds of stale suggestions cannot get back to a list worth reading.
Add Delete to the bulk bar, behind a confirmation, so a customer can clear what they will never act on.
Why it is needed
Generation appends nightly. Across production the open (new) list averages 147 rows per brand and reaches 773 on the largest, against 114 dismissed in total — dismissal is not what people reach for, and it would not shrink the table anyway.
Nothing here is a bug. The page simply has no way to say "these are not useful, remove them."
What to build
The bulk bar already has the exact pattern to copy. Dismiss all opens a Dialog, states the count, and only acts from the dialog's confirm button. Delete should be the same shape, with wording that says the removal is permanent, and should sit last in the row so it is not the neighbour of a routine action.
Server side, POST /api/content/bulk/status is the model to follow: it validates that ids is a non-empty array and calls assertOpportunitiesAccess(ids, req.user.id) before touching anything. A delete endpoint needs the same guard — the check is what stops one organization from passing another's ids.
Two things to settle while implementing
A deleted opportunity takes its brief with it. The generated brief is a column on the opportunity row, not a separate record, so deleting the row destroys it. Briefs are metered against a monthly quota, which means a customer can delete something they paid for and cannot regenerate for free. 38 opportunities currently carry a brief. The confirmation should name this when the selection includes one, rather than describing every deletion the same way.
Note that brief_usage.opportunity_id is ON DELETE SET NULL, so the usage record survives — the quota already spent stays spent. That is correct and should not change.
Who may delete. The existing bulk endpoints authorize by organization membership alone, so any member can currently mark another member's work done. Permanent deletion is a stronger action than any of those, and it is worth deciding whether it should be restricted to admins and managers the way integration changes are. Either answer is defensible; it should be a decision rather than an inherited default.
Scope
- A bulk delete endpoint in
server/src/routes/content.js, guarded like its neighbours - A server action in
web/src/lib/actions/content.tsalongsidebulkUpdateStatus - A Delete button plus confirmation dialog in the bulk bar of the Content page
- Translation keys for the button, dialog title and confirmation copy
Single-row deletion is not part of this. The bulk bar is where the problem is, and a per-row delete invites accidents on a list this long.
How to test
- Select several opportunities, confirm the Delete button appears only while a selection exists, and cancel the dialog — nothing is removed.
- Confirm the dialog and verify the rows are gone after a reload, not merely hidden by the status filter.
- Select an opportunity that has a brief and confirm the wording says the brief goes with it.
- Verify the pagination total and the selection state both reset correctly once rows disappear.
- Confirm ids belonging to another organization are rejected rather than deleted.
Activity
fix(content): keep filters reachable on zero results, and allow delet…
fix(content): keep filters reachable on zero results, and allow delet…