From baa5a3588a7bc12ce98ee23b6df70f884a467602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Mon, 27 Jul 2026 16:12:17 +0200 Subject: [PATCH] Lock only document rows without an access record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bulk request skips any id that already has an access record, so rejected or revoked rows reported success while creating nothing. Treat a row as requestable only when the viewer is unauthorized and no access record exists yet, keeping the selection CTA count honest. Signed-off-by: Émile Ré --- .../src/pages/documents/DocumentsPage.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/compliance-portal/src/pages/documents/DocumentsPage.tsx b/apps/compliance-portal/src/pages/documents/DocumentsPage.tsx index 745e06bc7..4b08e5720 100644 --- a/apps/compliance-portal/src/pages/documents/DocumentsPage.tsx +++ b/apps/compliance-portal/src/pages/documents/DocumentsPage.tsx @@ -164,11 +164,15 @@ export function DocumentsPage({ queryRef }: DocumentsPageProps) { const total = documentNodes.length + fileNodes.length + auditNodes.length; - // A row is "locked" (an access request would do something) when the viewer is - // not authorized and no request is already pending. Computed at page level so - // the selection bar can count locked rows without reaching into each fragment. + // A row is "locked" (a bulk access request would actually do something) only + // when the viewer is not authorized and no access record exists yet. The + // backend skips any id that already has a record — REQUESTED, GRANTED, + // REJECTED, or REVOKED — so those rows are treated as non-requestable to keep + // the CTA count honest and avoid a success toast that changes nothing. + // Computed at page level so the selection bar can count locked rows without + // reaching into each fragment. const isLocked = (isUserAuthorized: boolean, status: string | null | undefined) => - !isUserAuthorized && status !== "REQUESTED"; + !isUserAuthorized && status == null; const selectionEntries: DocumentSelectionEntry[] = [ ...documentNodes.map(node => ({