From 2be3964d84d8344829e8e690acf1a85d34dc13e4 Mon Sep 17 00:00:00 2001 From: ephraimduncan Date: Thu, 24 Sep 2026 13:29:44 +0000 Subject: [PATCH] fix(inbox): show partially approved only when the user signed A recipient rejection sets the recipient to REJECTED before the seal job sets the document to REJECTED. During this time, the inbox showed the document as partially approved. At this time, a pending document is partially approved only when the user signed each non-CC recipient. --- apps/remix/app/components/tables/inbox-table.tsx | 2 +- packages/app-tests/e2e/api/trpc/find-inbox.spec.ts | 12 +++++++++++- packages/trpc/server/document-router/find-inbox.ts | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/remix/app/components/tables/inbox-table.tsx b/apps/remix/app/components/tables/inbox-table.tsx index 0705b6f21..aae2c27ca 100644 --- a/apps/remix/app/components/tables/inbox-table.tsx +++ b/apps/remix/app/components/tables/inbox-table.tsx @@ -272,7 +272,7 @@ const getInboxStatus = (row: DocumentsTableRow, email: string) => { (recipient) => recipient.email !== email || recipient.role === RecipientRole.CC || - recipient.signingStatus !== SigningStatus.NOT_SIGNED, + recipient.signingStatus === SigningStatus.SIGNED, ); return isWaitingOnOthers ? ExtendedDocumentStatus.PARTIALLY_APPROVED : row.status; diff --git a/packages/app-tests/e2e/api/trpc/find-inbox.spec.ts b/packages/app-tests/e2e/api/trpc/find-inbox.spec.ts index abf0a7690..747fa7af6 100644 --- a/packages/app-tests/e2e/api/trpc/find-inbox.spec.ts +++ b/packages/app-tests/e2e/api/trpc/find-inbox.spec.ts @@ -385,10 +385,20 @@ test.describe('Inbox Find - Status Filter Hardening', () => { data: { signingStatus: SigningStatus.SIGNED }, }); + // The recipient has rejected, but the seal job has not yet moved the document to REJECTED. + const rejecting = await seedPendingDocument(sender, senderTeam.id, [recipient, otherRecipient], { + createDocumentOptions: { title: 'Scoped Rejecting Document' }, + }); + + await prisma.recipient.updateMany({ + where: { envelopeId: rejecting.id, email: recipient.email }, + data: { signingStatus: SigningStatus.REJECTED }, + }); + await apiSignin({ page, email: recipient.email }); const expectations = [ - { status: 'PENDING', expected: ['Scoped Pending Document'] }, + { status: 'PENDING', expected: ['Scoped Rejecting Document', 'Scoped Pending Document'] }, { status: 'PARTIALLY_APPROVED', expected: ['Scoped Partially Approved Document'] }, { status: 'COMPLETED', expected: ['Scoped Completed Document'] }, { status: 'CANCELLED', expected: ['Scoped Cancelled Document'] }, diff --git a/packages/trpc/server/document-router/find-inbox.ts b/packages/trpc/server/document-router/find-inbox.ts index 563639184..9445f41ae 100644 --- a/packages/trpc/server/document-router/find-inbox.ts +++ b/packages/trpc/server/document-router/find-inbox.ts @@ -74,7 +74,7 @@ export const findInbox = async ({ userId, page = 1, perPage = 10, query = '', st const unsignedUserRecipient = { ...userRecipient, - signingStatus: SigningStatus.NOT_SIGNED, + signingStatus: { not: SigningStatus.SIGNED }, } satisfies Prisma.RecipientWhereInput; const statusWhere = match(status)