mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
fix: pending document edit (#1580)
Fix issue where you cannot edit a pending document when there is a CCer recipient.
This commit is contained in:
@ -372,12 +372,15 @@ type RecipientData = {
|
|||||||
const hasRecipientBeenChanged = (recipient: Recipient, newRecipientData: RecipientData) => {
|
const hasRecipientBeenChanged = (recipient: Recipient, newRecipientData: RecipientData) => {
|
||||||
const authOptions = ZRecipientAuthOptionsSchema.parse(recipient.authOptions);
|
const authOptions = ZRecipientAuthOptionsSchema.parse(recipient.authOptions);
|
||||||
|
|
||||||
|
const newRecipientAccessAuth = newRecipientData.accessAuth || null;
|
||||||
|
const newRecipientActionAuth = newRecipientData.actionAuth || null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
recipient.email !== newRecipientData.email ||
|
recipient.email !== newRecipientData.email ||
|
||||||
recipient.name !== newRecipientData.name ||
|
recipient.name !== newRecipientData.name ||
|
||||||
recipient.role !== newRecipientData.role ||
|
recipient.role !== newRecipientData.role ||
|
||||||
recipient.signingOrder !== newRecipientData.signingOrder ||
|
recipient.signingOrder !== newRecipientData.signingOrder ||
|
||||||
authOptions.accessAuth !== newRecipientData.accessAuth ||
|
authOptions.accessAuth !== newRecipientAccessAuth ||
|
||||||
authOptions.actionAuth !== newRecipientData.actionAuth
|
authOptions.actionAuth !== newRecipientActionAuth
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -235,12 +235,15 @@ type RecipientData = {
|
|||||||
const hasRecipientBeenChanged = (recipient: Recipient, newRecipientData: RecipientData) => {
|
const hasRecipientBeenChanged = (recipient: Recipient, newRecipientData: RecipientData) => {
|
||||||
const authOptions = ZRecipientAuthOptionsSchema.parse(recipient.authOptions);
|
const authOptions = ZRecipientAuthOptionsSchema.parse(recipient.authOptions);
|
||||||
|
|
||||||
|
const newRecipientAccessAuth = newRecipientData.accessAuth || null;
|
||||||
|
const newRecipientActionAuth = newRecipientData.actionAuth || null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
recipient.email !== newRecipientData.email ||
|
recipient.email !== newRecipientData.email ||
|
||||||
recipient.name !== newRecipientData.name ||
|
recipient.name !== newRecipientData.name ||
|
||||||
recipient.role !== newRecipientData.role ||
|
recipient.role !== newRecipientData.role ||
|
||||||
recipient.signingOrder !== newRecipientData.signingOrder ||
|
recipient.signingOrder !== newRecipientData.signingOrder ||
|
||||||
authOptions.accessAuth !== newRecipientData.accessAuth ||
|
authOptions.accessAuth !== newRecipientAccessAuth ||
|
||||||
authOptions.actionAuth !== newRecipientData.actionAuth
|
authOptions.actionAuth !== newRecipientActionAuth
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,8 +8,17 @@ export const formatSigningLink = (token: string) => `${NEXT_PUBLIC_WEBAPP_URL()}
|
|||||||
* Whether a recipient can be modified by the document owner.
|
* Whether a recipient can be modified by the document owner.
|
||||||
*/
|
*/
|
||||||
export const canRecipientBeModified = (recipient: Recipient, fields: Field[]) => {
|
export const canRecipientBeModified = (recipient: Recipient, fields: Field[]) => {
|
||||||
|
if (!recipient) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CCers can always be modified (unless document is completed).
|
||||||
|
if (recipient.role === RecipientRole.CC) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Deny if the recipient has already signed the document.
|
// Deny if the recipient has already signed the document.
|
||||||
if (!recipient || recipient.signingStatus === SigningStatus.SIGNED) {
|
if (recipient.signingStatus === SigningStatus.SIGNED) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user