mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
Merge branch 'main' into feat/expiry-links
This commit is contained in:
@ -101,5 +101,5 @@
|
|||||||
"vite-plugin-babel-macros": "^1.0.6",
|
"vite-plugin-babel-macros": "^1.0.6",
|
||||||
"vite-tsconfig-paths": "^5.1.4"
|
"vite-tsconfig-paths": "^5.1.4"
|
||||||
},
|
},
|
||||||
"version": "1.12.2-rc.3"
|
"version": "1.12.2-rc.4"
|
||||||
}
|
}
|
||||||
|
|||||||
6
package-lock.json
generated
6
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@documenso/root",
|
"name": "@documenso/root",
|
||||||
"version": "1.12.2-rc.3",
|
"version": "1.12.2-rc.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@documenso/root",
|
"name": "@documenso/root",
|
||||||
"version": "1.12.2-rc.3",
|
"version": "1.12.2-rc.4",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"apps/*",
|
"apps/*",
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@ -89,7 +89,7 @@
|
|||||||
},
|
},
|
||||||
"apps/remix": {
|
"apps/remix": {
|
||||||
"name": "@documenso/remix",
|
"name": "@documenso/remix",
|
||||||
"version": "1.12.2-rc.3",
|
"version": "1.12.2-rc.4",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@documenso/api": "*",
|
"@documenso/api": "*",
|
||||||
"@documenso/assets": "*",
|
"@documenso/assets": "*",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.12.2-rc.3",
|
"version": "1.12.2-rc.4",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
"dev": "turbo run dev --filter=@documenso/remix",
|
"dev": "turbo run dev --filter=@documenso/remix",
|
||||||
|
|||||||
@ -144,10 +144,11 @@ test('[TEMPLATES]: use template', async ({ page }) => {
|
|||||||
await page.getByRole('button', { name: 'Use Template' }).click();
|
await page.getByRole('button', { name: 'Use Template' }).click();
|
||||||
|
|
||||||
// Enter template values.
|
// Enter template values.
|
||||||
await page.getByPlaceholder('recipient.1@documenso.com').click();
|
// Get input with Email label placeholder.
|
||||||
await page.getByPlaceholder('recipient.1@documenso.com').fill(teamMemberUser.email);
|
await page.getByLabel('Email').click();
|
||||||
await page.getByPlaceholder('Recipient 1').click();
|
await page.getByLabel('Email').fill(teamMemberUser.email);
|
||||||
await page.getByPlaceholder('Recipient 1').fill('name');
|
await page.getByLabel('Name').click();
|
||||||
|
await page.getByLabel('Name').fill('name');
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Create as draft' }).click();
|
await page.getByRole('button', { name: 'Create as draft' }).click();
|
||||||
await page.waitForURL(/\/t\/.+\/documents/);
|
await page.waitForURL(/\/t\/.+\/documents/);
|
||||||
|
|||||||
@ -111,7 +111,7 @@ export const getDocumentWhereInput = async ({
|
|||||||
visibility: {
|
visibility: {
|
||||||
in: teamVisibilityFilters,
|
in: teamVisibilityFilters,
|
||||||
},
|
},
|
||||||
teamId,
|
teamId: team.id,
|
||||||
},
|
},
|
||||||
// Or, if they are a recipient of the document.
|
// Or, if they are a recipient of the document.
|
||||||
{
|
{
|
||||||
|
|||||||
@ -134,6 +134,9 @@ export const setDocumentRecipients = async ({
|
|||||||
existingRecipient.id === recipient.id || existingRecipient.email === recipient.email,
|
existingRecipient.id === recipient.id || existingRecipient.email === recipient.email,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const canPersistedRecipientBeModified =
|
||||||
|
existing && canRecipientBeModified(existing, document.fields);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
existing &&
|
existing &&
|
||||||
hasRecipientBeenChanged(existing, recipient) &&
|
hasRecipientBeenChanged(existing, recipient) &&
|
||||||
@ -147,6 +150,7 @@ export const setDocumentRecipients = async ({
|
|||||||
return {
|
return {
|
||||||
...recipient,
|
...recipient,
|
||||||
_persisted: existing,
|
_persisted: existing,
|
||||||
|
canPersistedRecipientBeModified,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -162,6 +166,13 @@ export const setDocumentRecipients = async ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recipient._persisted && !recipient.canPersistedRecipientBeModified) {
|
||||||
|
return {
|
||||||
|
...recipient._persisted,
|
||||||
|
clientId: recipient.clientId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const upsertedRecipient = await tx.recipient.upsert({
|
const upsertedRecipient = await tx.recipient.upsert({
|
||||||
where: {
|
where: {
|
||||||
id: recipient._persisted?.id ?? -1,
|
id: recipient._persisted?.id ?? -1,
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import type { Recipient } from '@prisma/client';
|
|
||||||
import { RecipientRole } from '@prisma/client';
|
import { RecipientRole } from '@prisma/client';
|
||||||
import { SendStatus, SigningStatus } from '@prisma/client';
|
import { SendStatus, SigningStatus } from '@prisma/client';
|
||||||
import { isDeepEqual } from 'remeda';
|
|
||||||
|
|
||||||
import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';
|
import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';
|
||||||
import type { TRecipientAccessAuthTypes } from '@documenso/lib/types/document-auth';
|
import type { TRecipientAccessAuthTypes } from '@documenso/lib/types/document-auth';
|
||||||
@ -104,10 +102,7 @@ export const updateDocumentRecipients = async ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!canRecipientBeModified(originalRecipient, document.fields)) {
|
||||||
hasRecipientBeenChanged(originalRecipient, recipient) &&
|
|
||||||
!canRecipientBeModified(originalRecipient, document.fields)
|
|
||||||
) {
|
|
||||||
throw new AppError(AppErrorCode.INVALID_REQUEST, {
|
throw new AppError(AppErrorCode.INVALID_REQUEST, {
|
||||||
message: 'Cannot modify a recipient who has already interacted with the document',
|
message: 'Cannot modify a recipient who has already interacted with the document',
|
||||||
});
|
});
|
||||||
@ -203,9 +198,6 @@ export const updateDocumentRecipients = async ({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* If you change this you MUST update the `hasRecipientBeenChanged` function.
|
|
||||||
*/
|
|
||||||
type RecipientData = {
|
type RecipientData = {
|
||||||
id: number;
|
id: number;
|
||||||
email?: string;
|
email?: string;
|
||||||
@ -215,19 +207,3 @@ type RecipientData = {
|
|||||||
accessAuth?: TRecipientAccessAuthTypes[];
|
accessAuth?: TRecipientAccessAuthTypes[];
|
||||||
actionAuth?: TRecipientActionAuthTypes[];
|
actionAuth?: TRecipientActionAuthTypes[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasRecipientBeenChanged = (recipient: Recipient, newRecipientData: RecipientData) => {
|
|
||||||
const authOptions = ZRecipientAuthOptionsSchema.parse(recipient.authOptions);
|
|
||||||
|
|
||||||
const newRecipientAccessAuth = newRecipientData.accessAuth || null;
|
|
||||||
const newRecipientActionAuth = newRecipientData.actionAuth || null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
recipient.email !== newRecipientData.email ||
|
|
||||||
recipient.name !== newRecipientData.name ||
|
|
||||||
recipient.role !== newRecipientData.role ||
|
|
||||||
recipient.signingOrder !== newRecipientData.signingOrder ||
|
|
||||||
!isDeepEqual(authOptions.accessAuth, newRecipientAccessAuth) ||
|
|
||||||
!isDeepEqual(authOptions.actionAuth, newRecipientActionAuth)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -141,6 +141,7 @@ export const authenticatedMiddleware = t.middleware(async ({ ctx, next, path })
|
|||||||
return await next({
|
return await next({
|
||||||
ctx: {
|
ctx: {
|
||||||
...ctx,
|
...ctx,
|
||||||
|
teamId: ctx.teamId || -1,
|
||||||
logger: trpcSessionLogger,
|
logger: trpcSessionLogger,
|
||||||
user: ctx.user,
|
user: ctx.user,
|
||||||
session: ctx.session,
|
session: ctx.session,
|
||||||
|
|||||||
Reference in New Issue
Block a user