Skip to content

The Open Source DocuSign Alternative.

fix: prevent recipients who already signed from rejecting documents (#3411)

Catalin Pitf4105e47eba5
diff --git a/packages/lib/server-only/document/reject-document-with-token.ts b/packages/lib/server-only/document/reject-document-with-token.ts
index a8555b42b..24e6c2d9b 100644
--- a/packages/lib/server-only/document/reject-document-with-token.ts
+++ b/packages/lib/server-only/document/reject-document-with-token.ts
@@ -51,6 +51,12 @@ export async function rejectDocumentWithToken({ token, id, reason, requestMetada
});
}
+ if (recipient.signingStatus !== SigningStatus.NOT_SIGNED) {
+ throw new AppError(AppErrorCode.INVALID_REQUEST, {
+ message: `Recipient ${recipient.id} has already actioned this document`,
+ });
+ }
+
assertRecipientNotExpired(recipient);
// Update the recipient status to rejected