Skip to content

Commit

Permalink
feat: allow editing pending documents (documenso#1346)
Browse files Browse the repository at this point in the history
## Description

Adds the ability for the document owner to edit recipients and their
fields after the document has been sent.

A recipient can only be updated or deleted if:
- The recipient has not inserted any fields
- Has not completed the document

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

- **New Features**
- Added new localization messages to clarify user actions regarding
document signing.
  - Enhanced French translations for improved user interaction.

- **Improvements**
- Updated localization strings in German and English for clearer
feedback on signer and recipient statuses.
- Improved overall structure of localization files for better
maintainability.

- **Dependency Updates**
- Upgraded `next-axiom` and `remeda` libraries to their latest versions,
potentially enhancing performance and stability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mythie <[email protected]>
  • Loading branch information
dguyen and Mythie authored Sep 20, 2024
1 parent efb2bc9 commit ddee8a8
Show file tree
Hide file tree
Showing 21 changed files with 534 additions and 205 deletions.
4 changes: 2 additions & 2 deletions apps/marketing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"micro": "^10.0.1",
"next": "14.2.6",
"next-auth": "4.24.5",
"next-axiom": "^1.1.1",
"next-axiom": "^1.5.1",
"next-contentlayer": "^0.3.4",
"next-plausible": "^3.10.1",
"perfect-freehand": "^1.2.0",
Expand All @@ -56,4 +56,4 @@
"@types/react": "^18",
"@types/react-dom": "^18"
}
}
}
6 changes: 3 additions & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"micro": "^10.0.1",
"next": "14.2.6",
"next-auth": "4.24.5",
"next-axiom": "^1.1.1",
"next-axiom": "^1.5.1",
"next-plausible": "^3.10.1",
"next-themes": "^0.2.1",
"papaparse": "^5.4.1",
Expand All @@ -53,7 +53,7 @@
"react-icons": "^4.11.0",
"react-rnd": "^10.4.1",
"recharts": "^2.7.2",
"remeda": "^1.27.1",
"remeda": "^2.12.1",
"sharp": "0.32.6",
"ts-pattern": "^5.0.5",
"ua-parser-js": "^1.0.37",
Expand All @@ -74,4 +74,4 @@
"@types/ua-parser-js": "^0.7.39",
"typescript": "5.2.2"
}
}
}
98 changes: 75 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/ee/server-only/limits/provider/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { createContext, useCallback, useContext, useEffect, useState } from 'react';

import { equals } from 'remeda';
import { isDeepEqual } from 'remeda';

import { getLimits } from '../client';
import { FREE_PLAN_LIMITS } from '../constants';
Expand Down Expand Up @@ -42,7 +42,7 @@ export const LimitsProvider = ({
const newLimits = await getLimits({ teamId });

setLimits((oldLimits) => {
if (equals(oldLimits, newLimits)) {
if (isDeepEqual(oldLimits, newLimits)) {
return oldLimits;
}

Expand Down
78 changes: 78 additions & 0 deletions packages/email/templates/recipient-removed-from-document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import config from '@documenso/tailwind-config';

import {
Body,
Container,
Head,
Hr,
Html,
Img,
Preview,
Section,
Tailwind,
Text,
} from '../components';
import type { TemplateDocumentCancelProps } from '../template-components/template-document-cancel';
import TemplateDocumentImage from '../template-components/template-document-image';
import { TemplateFooter } from '../template-components/template-footer';

export type DocumentCancelEmailTemplateProps = Partial<TemplateDocumentCancelProps>;

export const RecipientRemovedFromDocumentTemplate = ({
inviterName = 'Lucas Smith',
documentName = 'Open Source Pledge.pdf',
assetBaseUrl = 'http://localhost:3002',
}: DocumentCancelEmailTemplateProps) => {
const previewText = `${inviterName} has removed you from the document ${documentName}.`;

const getAssetUrl = (path: string) => {
return new URL(path, assetBaseUrl).toString();
};

return (
<Html>
<Head />
<Preview>{previewText}</Preview>
<Tailwind
config={{
theme: {
extend: {
colors: config.theme.extend.colors,
},
},
}}
>
<Body className="mx-auto my-auto bg-white font-sans">
<Section>
<Container className="mx-auto mb-2 mt-8 max-w-xl rounded-lg border border-solid border-slate-200 p-4 backdrop-blur-sm">
<Section>
<Img
src={getAssetUrl('/static/logo.png')}
alt="Documenso Logo"
className="mb-4 h-6"
/>

<TemplateDocumentImage className="mt-6" assetBaseUrl={assetBaseUrl} />

<Section>
<Text className="text-primary mx-auto mb-0 max-w-[80%] text-center text-lg font-semibold">
{inviterName} has removed you from the document
<br />"{documentName}"
</Text>
</Section>
</Section>
</Container>

<Hr className="mx-auto mt-12 max-w-xl" />

<Container className="mx-auto max-w-xl">
<TemplateFooter />
</Container>
</Section>
</Body>
</Tailwind>
</Html>
);
};

export default RecipientRemovedFromDocumentTemplate;
2 changes: 1 addition & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"pg": "^8.11.3",
"playwright": "1.43.0",
"react": "^18",
"remeda": "^1.27.1",
"remeda": "^2.12.1",
"sharp": "0.32.6",
"stripe": "^12.7.0",
"ts-pattern": "^5.0.5",
Expand Down
Loading

0 comments on commit ddee8a8

Please sign in to comment.