mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 01:01:49 +10:00
fix: cleanup
This commit is contained in:
@ -70,6 +70,7 @@ export async function loader({ request }: Route.LoaderArgs) {
|
||||
id: mapSecondaryIdToDocumentId(envelope.secondaryId),
|
||||
title: envelope.title,
|
||||
status: envelope.status,
|
||||
envelopeId: envelope.id,
|
||||
user: {
|
||||
name: envelope.user.name,
|
||||
email: envelope.user.email,
|
||||
@ -109,10 +110,9 @@ export default function AuditLog({ loaderData }: Route.ComponentProps) {
|
||||
<Card>
|
||||
<CardContent className="grid grid-cols-2 gap-4 p-6 text-sm print:text-xs">
|
||||
<p>
|
||||
{/* Todo: Envelopes - [PRE-MAIN] Should we should envelope ID instead here? */}
|
||||
<span className="font-medium">{_(msg`Document ID`)}</span>
|
||||
<span className="font-medium">{_(msg`Envelope ID`)}</span>
|
||||
|
||||
<span className="mt-1 block break-words">{document.id}</span>
|
||||
<span className="mt-1 block break-words">{document.envelopeId}</span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@ -775,7 +775,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {
|
||||
name: recipient.name,
|
||||
email: recipient.email,
|
||||
signingOrder: recipient.signingOrder,
|
||||
role: recipient.role, // Todo: Migration - Should you actually be able to change the role???
|
||||
role: recipient.role, // You probably shouldn't be able to change the role.
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@ -99,19 +99,13 @@ export const run = async ({
|
||||
});
|
||||
|
||||
// This is the same case as above.
|
||||
let envelopeItems: typeof envelope.envelopeItems = await io.runTask(
|
||||
'get-document-data-id', // Todo: Envelopes [PRE-MAIN] - Fix these messed up types.
|
||||
// eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-explicit-any
|
||||
async (): Promise<any> => {
|
||||
return envelope.envelopeItems.map((envelopeItem) => ({
|
||||
...envelopeItem,
|
||||
fields: envelopeItem.field.map((field) => ({
|
||||
...field,
|
||||
positionX: Number(field.positionX),
|
||||
positionY: Number(field.positionY),
|
||||
width: Number(field.width),
|
||||
height: Number(field.height),
|
||||
})),
|
||||
let envelopeItems = await io.runTask(
|
||||
'get-document-data-id',
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
async () => {
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||
return envelope.envelopeItems.map(({ field, ...rest }) => ({
|
||||
...rest,
|
||||
}));
|
||||
},
|
||||
);
|
||||
@ -186,16 +180,25 @@ export const run = async ({
|
||||
|
||||
const newDocumentData = await Promise.all(
|
||||
envelopeItems.map(async (envelopeItem) =>
|
||||
io.runTask('decorate-and-sign-pdf', async () =>
|
||||
decorateAndSignPdf({
|
||||
io.runTask('decorate-and-sign-pdf', async () => {
|
||||
const envelopeItemFields = envelope.envelopeItems.find(
|
||||
(item) => item.id === envelopeItem.id,
|
||||
)?.field;
|
||||
|
||||
if (!envelopeItemFields) {
|
||||
throw new Error(`Envelope item fields not found for envelope item ${envelopeItem.id}`);
|
||||
}
|
||||
|
||||
return decorateAndSignPdf({
|
||||
envelope,
|
||||
envelopeItem,
|
||||
envelopeItemFields,
|
||||
isRejected,
|
||||
rejectionReason,
|
||||
certificateData,
|
||||
auditLogData,
|
||||
}),
|
||||
),
|
||||
});
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
@ -293,7 +296,8 @@ export const run = async ({
|
||||
|
||||
type DecorateAndSignPdfOptions = {
|
||||
envelope: Pick<Envelope, 'id' | 'title' | 'useLegacyFieldInsertion' | 'internalVersion'>;
|
||||
envelopeItem: EnvelopeItem & { documentData: DocumentData; field: Field[] };
|
||||
envelopeItem: EnvelopeItem & { documentData: DocumentData };
|
||||
envelopeItemFields: Field[];
|
||||
isRejected: boolean;
|
||||
rejectionReason: string;
|
||||
certificateData: Buffer | null;
|
||||
@ -306,6 +310,7 @@ type DecorateAndSignPdfOptions = {
|
||||
const decorateAndSignPdf = async ({
|
||||
envelope,
|
||||
envelopeItem,
|
||||
envelopeItemFields,
|
||||
isRejected,
|
||||
rejectionReason,
|
||||
certificateData,
|
||||
@ -348,7 +353,7 @@ const decorateAndSignPdf = async ({
|
||||
});
|
||||
}
|
||||
|
||||
for (const field of envelopeItem.field) {
|
||||
for (const field of envelopeItemFields) {
|
||||
if (field.inserted) {
|
||||
if (envelope.internalVersion === 2) {
|
||||
await insertFieldInPDFV2(pdfDoc, field);
|
||||
|
||||
@ -257,7 +257,6 @@ const injectFormValuesIntoDocument = async (
|
||||
id: envelopeItem.id,
|
||||
},
|
||||
data: {
|
||||
// Todo: Envelopes [PRE-MAIN] - Should this also replace the initial data? Because if it's resealed we use the initial data thus lose the form values.
|
||||
documentDataId: newDocumentData.id,
|
||||
},
|
||||
});
|
||||
|
||||
@ -88,7 +88,7 @@ export const createEnvelopeFields = async ({
|
||||
// The item to attach the fields to MUST belong to the document.
|
||||
if (
|
||||
field.envelopeItemId &&
|
||||
!envelope.envelopeItems.find((envelopeItem) => envelopeItem.id === field.envelopeItemId) // Todo: Migration test this
|
||||
!envelope.envelopeItems.find((envelopeItem) => envelopeItem.id === field.envelopeItemId)
|
||||
) {
|
||||
throw new AppError(AppErrorCode.INVALID_REQUEST, {
|
||||
message: 'Item to attach fields to must belong to the document',
|
||||
|
||||
@ -395,7 +395,6 @@ export const createDocumentFromTemplate = async ({
|
||||
const oldEnvelopeItemToNewEnvelopeItemIdMap: Record<string, string> = {};
|
||||
|
||||
// Duplicate the envelope item data.
|
||||
// Todo: Envelopes - Ask if it's okay to just use the documentDataId? Or should it be duplicated?
|
||||
// Note: This is duplicated in createDocumentFromDirectTemplate
|
||||
const envelopeItemsToCreate = await Promise.all(
|
||||
template.envelopeItems.map(async (item, i) => {
|
||||
@ -424,9 +423,6 @@ export const createDocumentFromTemplate = async ({
|
||||
|
||||
const buffer = await getFileServerSide(documentDataToDuplicate);
|
||||
|
||||
// Todo: Envelopes [PRE-MAIN] - Should we normalize? Should be part of the upload.
|
||||
// const normalizedPdf = await makeNormalizedPdf(Buffer.from(buffer));
|
||||
|
||||
const titleToUse = item.title || finalEnvelopeTitle;
|
||||
|
||||
const duplicatedFile = await putPdfFileServerSide({
|
||||
|
||||
@ -3301,7 +3301,6 @@ msgstr ""
|
||||
msgid "Document found in your account"
|
||||
msgstr "Dokument in Ihrem Konto gefunden"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx
|
||||
msgid "Document ID"
|
||||
msgstr "Dokument-ID"
|
||||
@ -3962,6 +3961,10 @@ msgstr ""
|
||||
msgid "Envelope Duplicated"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
msgid "Envelope ID"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx
|
||||
msgid "Envelope resent"
|
||||
msgstr ""
|
||||
|
||||
@ -3296,7 +3296,6 @@ msgstr "Document external ID updated"
|
||||
msgid "Document found in your account"
|
||||
msgstr "Document found in your account"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx
|
||||
msgid "Document ID"
|
||||
msgstr "Document ID"
|
||||
@ -3957,6 +3956,10 @@ msgstr "Envelope distributed"
|
||||
msgid "Envelope Duplicated"
|
||||
msgstr "Envelope Duplicated"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
msgid "Envelope ID"
|
||||
msgstr "Envelope ID"
|
||||
|
||||
#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx
|
||||
msgid "Envelope resent"
|
||||
msgstr "Envelope resent"
|
||||
|
||||
@ -3301,7 +3301,6 @@ msgstr ""
|
||||
msgid "Document found in your account"
|
||||
msgstr "Documento encontrado en tu cuenta"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx
|
||||
msgid "Document ID"
|
||||
msgstr "ID del documento"
|
||||
@ -3962,6 +3961,10 @@ msgstr ""
|
||||
msgid "Envelope Duplicated"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
msgid "Envelope ID"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx
|
||||
msgid "Envelope resent"
|
||||
msgstr ""
|
||||
|
||||
@ -3301,7 +3301,6 @@ msgstr ""
|
||||
msgid "Document found in your account"
|
||||
msgstr "Document trouvé dans votre compte"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx
|
||||
msgid "Document ID"
|
||||
msgstr "ID du document"
|
||||
@ -3962,6 +3961,10 @@ msgstr ""
|
||||
msgid "Envelope Duplicated"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
msgid "Envelope ID"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx
|
||||
msgid "Envelope resent"
|
||||
msgstr ""
|
||||
|
||||
@ -3301,7 +3301,6 @@ msgstr ""
|
||||
msgid "Document found in your account"
|
||||
msgstr "Documento trovato nel tuo account"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx
|
||||
msgid "Document ID"
|
||||
msgstr "ID del documento"
|
||||
@ -3962,6 +3961,10 @@ msgstr ""
|
||||
msgid "Envelope Duplicated"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
msgid "Envelope ID"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx
|
||||
msgid "Envelope resent"
|
||||
msgstr ""
|
||||
|
||||
@ -3301,7 +3301,6 @@ msgstr ""
|
||||
msgid "Document found in your account"
|
||||
msgstr "Dokument znaleziony na Twoim koncie"
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx
|
||||
msgid "Document ID"
|
||||
msgstr "Identyfikator dokumentu"
|
||||
@ -3962,6 +3961,10 @@ msgstr ""
|
||||
msgid "Envelope Duplicated"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx
|
||||
msgid "Envelope ID"
|
||||
msgstr ""
|
||||
|
||||
#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx
|
||||
msgid "Envelope resent"
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user