Lock only document rows without an access record
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é <emile@probo.com>
This commit is contained in:
@@ -164,11 +164,15 @@ export function DocumentsPage({ queryRef }: DocumentsPageProps) {
|
|||||||
|
|
||||||
const total = documentNodes.length + fileNodes.length + auditNodes.length;
|
const total = documentNodes.length + fileNodes.length + auditNodes.length;
|
||||||
|
|
||||||
// A row is "locked" (an access request would do something) when the viewer is
|
// A row is "locked" (a bulk access request would actually do something) only
|
||||||
// not authorized and no request is already pending. Computed at page level so
|
// when the viewer is not authorized and no access record exists yet. The
|
||||||
// the selection bar can count locked rows without reaching into each fragment.
|
// 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) =>
|
const isLocked = (isUserAuthorized: boolean, status: string | null | undefined) =>
|
||||||
!isUserAuthorized && status !== "REQUESTED";
|
!isUserAuthorized && status == null;
|
||||||
|
|
||||||
const selectionEntries: DocumentSelectionEntry[] = [
|
const selectionEntries: DocumentSelectionEntry[] = [
|
||||||
...documentNodes.map(node => ({
|
...documentNodes.map(node => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user