Repository navigation
feat(action-center): change or delete an action from its row menu - #1144
Conversation
Each row of the Actions list gets a "…" menu that opens downward with In Progress, Completed, Dismiss and Delete, so an action is moved or removed without opening its drawer. The status it already has is off, Delete asks first and is for admins and managers, and the menu column stays at the table's right edge when the table scrolls sideways. Delete hides rather than removes (migration 00168): the action becomes dismissed with deleted_at, so the nightly generator still reads a dismissed action and keeps its rest window, and a condition that is still firing doesn't bring it back the next night. Members' select policy leaves deleted actions out, which covers every list, History and the task, event and signal-link reads; the admin reads behind MCP, the API and exports filter them; and sync_opportunity_status no longer counts them. DELETE /api/action-center/actions/:id does it, checked against the caller's organization and role, and records the event. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@gkhngyk The product owner asked for a row menu on Action Center actions (In Progress, Completed, Dismiss, Delete without the drawer). Delete hides rather than removes: migration 00168 adds actions.deleted_at, the member select policy leaves deleted rows out, and DELETE /api/action-center/actions/:id (admins and managers) sets dismissed + deleted_at so the generator keeps its rest window. Applied on the dev DB; deploy needs 00168. Thanks! |
gkhngyk
left a comment
There was a problem hiding this comment.
Checked on main with the rest of tonight's PRs stacked on top. The delete route tests, action table tests, MCP export tests, typecheck, lint and format pass, and CI is green.
00168 is applied on production. sync_opportunity_status matches the live definition apart from the new deleted_at is null filter. action_events has no check constraint on event, so the deleted event inserts.
Checked as authenticated: a member still reads the brand's 47 actions, and a user from another organization reads none. Deleted rows stay dismissed, so the open-action dedup index (00084) and the generator's rest window treat them as any dismissed action.
Summary
Each Action Center action gets a row menu: In Progress, Completed, Dismiss and Delete, without opening the drawer. This was requested by the product owner.
Web
updateActionStatus, as the drawer does. A toast says "Moved to In Progress", and the list reloads.canManage).sticky right-0, with the row's hover tint). The table already scrolls sideways below about 1,100px, and at 1024px the menu sat off-screen.Delete hides, it doesn't remove: migration
00168_actions_soft_delete.sqlA deleted action becomes
dismissedwith a newdeleted_at, and the row stays.deleted_at is null. That hides deleted actions from every member read at once: the list, History, and the task, event and signal-link policies, which look actions up through it.sync_opportunity_status(security definer) no longer counts deleted actions. A Content opportunity whose only action is deleted keeps its status.Server
DELETE /api/action-center/actions/:id:assertBrandAccess), then the caller's role (admin or manager, else 403).status = 'dismissed',deleted_at,completed_at = nullandupdated_at, guarded bydeleted_at is null.deletedevent with the actor.Admin reads (MCP, API, exports)
These run on the admin client, past RLS, so they filter
deleted_atthemselves:listActionsFor,getActionFor,listActionHistoryFor;signalActionRefs(used_by_actions);updateTaskStatusFor, which refuses a deleted action's task;exportActionFor.Deploy
Apply 00168. It doesn't depend on #1139's 00167; the numbers only keep their order.
Related issue
None. Requested by the product owner.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
dismissedwithdeleted_at.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no errors; the 7 warnings are in files this PR does not touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
server:npm run format,npm run lintandnpm test(1536) pass.routes/action-center-delete.test.jscovers the soft delete and its event, the organization check, the role check, and a missing or already deleted action.web:yarn test(1337) andyarn buildpass.action-table.test.tsx: the menu's items, the current status off, a status change without opening the drawer, the delete confirmation, Delete off without the role, the busy state, and no menu without handlers.lib/mcp/action-center.test.ts: the task check excludes deleted actions. The other MCP test mocks learned.is.bash supabase/build-schema.sh: regeneratedschema.sql.dismissedwithdeleted_atin the database, and its trail readstatus_changed, deleted.🤖 Generated with Claude Code