mirror of
https://github.com/documenso/documenso.git
synced 2026-09-29 16:24:30 +10:00
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:
@@ -272,7 +272,7 @@ const getInboxStatus = (row: DocumentsTableRow, email: string) => {
|
|||||||
(recipient) =>
|
(recipient) =>
|
||||||
recipient.email !== email ||
|
recipient.email !== email ||
|
||||||
recipient.role === RecipientRole.CC ||
|
recipient.role === RecipientRole.CC ||
|
||||||
recipient.signingStatus !== SigningStatus.NOT_SIGNED,
|
recipient.signingStatus === SigningStatus.SIGNED,
|
||||||
);
|
);
|
||||||
|
|
||||||
return isWaitingOnOthers ? ExtendedDocumentStatus.PARTIALLY_APPROVED : row.status;
|
return isWaitingOnOthers ? ExtendedDocumentStatus.PARTIALLY_APPROVED : row.status;
|
||||||
|
|||||||
@@ -385,10 +385,20 @@ test.describe('Inbox Find - Status Filter Hardening', () => {
|
|||||||
data: { signingStatus: SigningStatus.SIGNED },
|
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 });
|
await apiSignin({ page, email: recipient.email });
|
||||||
|
|
||||||
const expectations = [
|
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: 'PARTIALLY_APPROVED', expected: ['Scoped Partially Approved Document'] },
|
||||||
{ status: 'COMPLETED', expected: ['Scoped Completed Document'] },
|
{ status: 'COMPLETED', expected: ['Scoped Completed Document'] },
|
||||||
{ status: 'CANCELLED', expected: ['Scoped Cancelled Document'] },
|
{ status: 'CANCELLED', expected: ['Scoped Cancelled Document'] },
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export const findInbox = async ({ userId, page = 1, perPage = 10, query = '', st
|
|||||||
|
|
||||||
const unsignedUserRecipient = {
|
const unsignedUserRecipient = {
|
||||||
...userRecipient,
|
...userRecipient,
|
||||||
signingStatus: SigningStatus.NOT_SIGNED,
|
signingStatus: { not: SigningStatus.SIGNED },
|
||||||
} satisfies Prisma.RecipientWhereInput;
|
} satisfies Prisma.RecipientWhereInput;
|
||||||
|
|
||||||
const statusWhere = match(status)
|
const statusWhere = match(status)
|
||||||
|
|||||||
Reference in New Issue
Block a user