From e09c07624137db8841e61b3a160756460875d4cf Mon Sep 17 00:00:00 2001 From: Mythie Date: Thu, 28 Sep 2023 12:35:21 +1000 Subject: [PATCH] fix: do not overwrite new names or emails for signers --- .../server-only/recipient/set-recipients-for-document.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/lib/server-only/recipient/set-recipients-for-document.ts b/packages/lib/server-only/recipient/set-recipients-for-document.ts index 17263a693..198f79be1 100644 --- a/packages/lib/server-only/recipient/set-recipients-for-document.ts +++ b/packages/lib/server-only/recipient/set-recipients-for-document.ts @@ -57,12 +57,13 @@ export const setRecipientsForDocument = async ({ return { ...recipient, - ...existing, + _persisted: existing, }; }) .filter((recipient) => { return ( - recipient.sendStatus !== SendStatus.SENT && recipient.signingStatus !== SigningStatus.SIGNED + recipient._persisted?.sendStatus !== SendStatus.SENT && + recipient._persisted?.signingStatus !== SigningStatus.SIGNED ); }); @@ -72,7 +73,7 @@ export const setRecipientsForDocument = async ({ linkedRecipients.map((recipient) => prisma.recipient.upsert({ where: { - id: recipient.id ?? -1, + id: recipient._persisted?.id ?? -1, documentId, }, update: {