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.
This commit is contained in:
ephraimduncan
2026-09-24 13:29:44 +00:00
parent c3483aeaa8
commit 2be3964d84
3 changed files with 13 additions and 3 deletions
@@ -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;
@@ -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'] },
@@ -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)