Repository navigation
fix(platform): apply the row menu's rule to contact bulk delete - #4215
Conversation
When every loaded row fails a table's `enableRowSelection` predicate, `createSelectColumn` drops the select-all box and left the column's `<th>` with no text (axe `empty-table-header`), the failure the DataTable already fixes for the expander, action and skeleton select headers. The header now carries the column's per-row name, "Select row" (`common.aria.selectRow`, present in every locale), as the expander column reads "Expand row". Contacts reaches this once synced rows lose their checkboxes (a synced-only page, a member who cannot write); the members list reaches it already when it shows only you.
A synced contact (source salesforce, hubspot, conversation, …) offers no Edit or Delete in its row menu, yet the contacts list gave every row a checkbox and handed the raw selection to `BulkDeleteBar`, so ticking it and choosing Delete selected trashed it. A member who cannot write got checkboxes too. The rule now has one home, `canEditContact(ability, contact)` (a writer, on a manually entered or uploaded contact), and the row menu, the details dialog and the list all ask it: - `enableRowSelection` takes it per row, so a synced row renders no checkbox (never a disabled one) and Select all skips it; - the table and the bar get the selection without any loaded contact that fails it, so a contact a sync took over after it was ticked (or a member who lost write access) is never deleted. An id no longer loaded stays, as before, so the count holds while a delete refetches. The app's DELETE route is unchanged: it shares `deleteContact` with the documented REST door, the update route has the same shape, and source ownership becomes a server refusal only with its own code and copy. The manual register gains KNOW-B21 and its automation row; the contacts docs say which contacts can be edited or deleted, in en, de and fr. Closes #3623
After the colon, the capitalised possessive read like the formal "Ihr" in a du-form page; the sentence now stands on its own.
|
Independent review verdict: accept Reviewed exact head The decision to leave Evidence checked: author evidence |
What changed
A synced contact (source
salesforce,hubspot,conversation, …) offers no Edit or Delete in its row menu, but the contacts list gave every row a checkbox and handed the raw selection toBulkDeleteBar: ticking the synced row and choosing Delete selected trashed it. A Member, who cannot write, got checkboxes too.canEditContact(ability, contact)incontacts/lib/contact-data.ts(a writer, on a contact entered or uploaded in Tale) is now what the row menu, the details dialog and the list ask.isEditableContactstays as its private half.ContactsTablepasses it as the per-rowenableRowSelectionpredicate the DataTable already supports (members and projects lists use the same mechanism). A synced row renders no checkbox, not a disabled one, and Select all skips it.BulkDeleteBarget the selection without any loaded contact that fails the rule. This covers a contact that a sync took over after it was ticked (PATCH /api/v1/contacts/{id}can changesource) and a member who loses write access mid-session: neither can be deleted. An id that is no longer loaded stays selected, as before, so the count does not shrink while a delete's own refetch removes rows.@tale/ui). When no row on the page can be selected,createSelectColumnused to drop the select-all box and leave an empty<th>(axeempty-table-header). This change made that state reachable on contacts (a synced-only page, a Member's view). The header now carries the column's per-row name, Select row (common.aria.selectRow, already in en/de/fr), the same way the expander column's header reads "Expand row". The members list gets the same fix when it shows only you.Decision: the app route stays as it is
DELETE /api/app/contacts/:idstill trashes a contact of any source. It sharesdeleteContactwith the documentedDELETE /api/v1/contacts/{id}, which the issue puts out of scope. The app's update route (POST /api/app/contacts/:id) has the same shape, and source ownership is a UI rule today: "the source would overwrite a local change", not an authorization rule. To make it a server refusal, both writes would need a code of their own, en/de/fr copy and a product decision on what an Editor may clean up (for example junkconversationcontacts). I'd suggest a separate issue for that. After this change, both UI paths follow the same rule.Sweep
common.aria.selectRow, which is present in every catalog.knowledge/structured-data.mdnow says, in en, de and fr, which contacts can be edited or deleted, and that synced rows have no checkbox.KNOW-B21(the real stack, the REST-seeded synced contact, the stale-selection PATCH, Member view and screen-reader name), plus its 🔶 component row inreference/automation.md. The agent note and the suite's Cost line are updated.How I verified it
Code proof is at
db9a71e5f. The head3a4ed6229only rewords one German docs sentence; the full docs suite (38 files, 254 tests) andlint:linkswere rerun there.contact-table.bulk-delete.test.tsxuses the real column config, row menu, selection and bulk bar; only the backend hooks are stubbed. At6524150fe(origin/main), 5 of 6 tests fail: the synced row has a checkbox, Select all puts every contact in the bar, a Member gets checkboxes, and the no-selectable-row page has checkboxes. With the fix, 6 of 6 pass. The manual-import control keeps both Delete and its checkbox.data-table.test.tsxgets "names the select column when no row can be selected". It fails against main'scolumn-builders.tsxand passes with the change.bunx vitest run --config vitest.ui.config.ts app/features/contacts …/member-table.test.tsx …/projects-table.test.tsx …/teams-table.test.tsx: 16 files, 130 tests passed.packages/ui:vitest --project unit data-table.test.tsx data-table-bulk-actions.test.tsx: 69 passed.services/docs: fullvitest --run: 38 files, 254 tests passed.oxlintandoxfmt --checkon every changed TS file are clean. An isolatedtscover the changed platform files (withapp/router.tsxand the global declarations) and over the changed UI files is clean.bun run knip:check,bun run lint:links,bun run lint:manual(1443 boxes) andcheck-guide.tsonknowledge.mdall pass.Not run here: a browser, the stack, E2E, the
test:browserproject, the whole-platform suites and the full type check. CI owns those. Backend integration is not in scope, since no backend file changed.Closes #3623