Repository navigation
feat: allow editing pending documents - #1346
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis pull request includes updates to the Changes
Possibly related PRs
Suggested labels
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files ignored due to path filters (1)
Files selected for processing (7)
Files skipped from review due to trivial changes (2)
Files skipped from review as they are similar to previous changes (3)
Additional comments not posted (11)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 💚🚀 |
9f3c833 to
b62dfdc
Compare
There was a problem hiding this comment.
Actionable comments posted: 27
Outside diff range and nitpick comments (14)
packages/lib/utils/recipients.ts (2)
1-1: Ensure consistent import style across the codebase.Consider using a consistent import style for the
@documenso/prisma/clientmodule throughout the codebase. If the codebase predominantly uses named imports, consider updating this import statement to match that style.-import { type Field, type Recipient, RecipientRole, SigningStatus } from '@documenso/prisma/client'; +import { Field, Recipient, RecipientRole, SigningStatus } from '@documenso/prisma/client';
1-33: Consider adding unit tests.To ensure the correctness and maintainability of these utility functions, it would be beneficial to add unit tests that cover various scenarios and edge cases. This will help catch any potential issues and serve as documentation for the expected behavior.
packages/ee/server-only/limits/provider/client.tsx (1)
Line range hint
1-78: Consider memoizing therefreshLimitsfunction.The
refreshLimitsfunction is recreated on every render due to its dependency onteamId. This could potentially lead to unnecessary re-creation of the function, especially ifteamIdremains stable.To optimize this, consider memoizing
refreshLimitsusinguseCallbackand providingteamIdas a dependency. This way,refreshLimitswill only be recreated whenteamIdchanges.Apply this diff to memoize
refreshLimits:const refreshLimits = useCallback(async () => { const newLimits = await getLimits({ teamId }); setLimits((oldLimits) => { if (isDeepEqual(oldLimits, newLimits)) { return oldLimits; } return newLimits; }); - }, []); + }, [teamId]);apps/web/package.json (1)
Line range hint
1-77: Consider adding or updating tests.Given the dependency upgrades in this pull request, it's crucial to ensure that the existing tests continue to pass and that new tests are added to cover any new functionality or changes introduced by the updated libraries.
- Review the existing test suite and update any tests that may be affected by the upgraded dependencies.
- Consider adding new tests to verify the behavior and compatibility of the updated libraries within the application.
- Run the test suite to ensure that all tests pass successfully with the updated dependencies.
Thorough testing will help maintain the stability and reliability of the application after the dependency upgrades.
packages/email/templates/recipient-removed-from-document.tsx (3)
19-19: Consider renaming the type for consistency.The type
DocumentCancelEmailTemplatePropsseems to be specific to theRecipientRemovedFromDocumentTemplatecomponent. Consider renaming it toRecipientRemovedFromDocumentTemplatePropsfor better consistency and clarity.-export type DocumentCancelEmailTemplateProps = Partial<TemplateDocumentCancelProps>; +export type RecipientRemovedFromDocumentTemplateProps = Partial<TemplateDocumentCancelProps>;
28-30: Consider using a more robust URL constructor.The current implementation of
getAssetUrlrelies on theURLconstructor, which may not handle all edge cases properly. Consider using a more robust library likeurl-parseorurl-jointo construct the asset URLs.- const getAssetUrl = (path: string) => { - return new URL(path, assetBaseUrl).toString(); - }; + const getAssetUrl = (path: string) => { + return urlJoin(assetBaseUrl, path); + };Don't forget to install the
url-joinpackage and import it at the top of the file:+import urlJoin from 'url-join';
78-78: Consider exporting the component directly.Since the component is already being exported as a named export on line 21, there's no need to have a separate default export. Consider removing this line to avoid confusion and stick with the named export.
-export default RecipientRemovedFromDocumentTemplate;packages/lib/server-only/recipient/set-recipients-for-document.ts (1)
24-25: Consider moving the email constants to a shared location.The
NEXT_PUBLIC_WEBAPP_URL,FROM_ADDRESS, andFROM_NAMEconstants are imported from separate files. If these constants are used in multiple places across the codebase, consider moving them to a shared constants file to improve maintainability and avoid duplication.You can refactor the code like this:
// shared/constants.ts export const NEXT_PUBLIC_WEBAPP_URL = 'https://example.com'; export const FROM_ADDRESS = '[email protected]'; export const FROM_NAME = 'Documenso'; // current file import { NEXT_PUBLIC_WEBAPP_URL, FROM_ADDRESS, FROM_NAME } from '../shared/constants';This way, if the values need to be updated in the future, you only need to change them in one place.
packages/lib/server-only/field/set-fields-for-document.ts (3)
339-352: Consider extractingFieldDatatype to a shared location.The
FieldDatatype consolidates the properties of a field, which is a positive change. However, since this type is likely to be used in other parts of the codebase, consider moving it to a shared location, such as a dedicated types file or a common library.This will promote reusability and maintain a single source of truth for the
FieldDatatype.
105-108: Handle recipient not found error gracefully.When a recipient is not found for a field, the code throws an
AppErrorwith theINVALID_REQUESTerror code. This is a good practice to prevent proceeding with invalid data.However, consider providing a more specific error message or error code to help identify the exact issue when debugging or handling errors. For example, you could use a dedicated error code like
RECIPIENT_NOT_FOUNDto distinguish this specific error case.
Line range hint
1-28: Organize imports for better readability.The file imports various dependencies, but the import statements could be organized more effectively to improve readability. Consider the following suggestions:
- Group imports by their origin (e.g., external libraries, internal modules).
- Sort imports alphabetically within each group.
- Add blank lines between groups to visually separate them.
This will make it easier to navigate and maintain the import section of the file.
packages/lib/translations/en/marketing.js (1)
1-1: Consider adding comments to document the purpose of keys.To improve maintainability and make it easier for developers to understand the context and usage of each key-value pair, consider adding inline comments to document their purpose, especially for less intuitive keys.
For example:
{ "eK0veR": "Our Enterprise License is great for large organizations looking to switch to Documenso for all their signing needs. It's available for our cloud offering as well as self-hosted setups and offers a wide range of compliance and Adminstration Features.", // Description of the Enterprise License offering // ... }packages/ui/primitives/document-flow/add-fields.tsx (2)
44-44: Consider providing more context in the alert message.The
Alertcomponent is used to display a warning message when a recipient can no longer be modified. Consider providing more context in the message to help the user understand why the recipient cannot be modified and what actions they can take, if any.
Line range hint
985-1014: Improve the user experience by providing more granular feedback.The changes introduce a warning alert when a recipient can no longer be modified due to signing a field or completing the document. This enhances the user experience by clearly communicating the state of the recipient's ability to interact with the document.
Consider providing even more granular feedback to the user by specifying which specific action (signing a field or completing the document) caused the recipient to become unmodifiable. This can help the user better understand the current state of the document and the recipients.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
Files selected for processing (15)
- apps/marketing/package.json (2 hunks)
- apps/web/package.json (3 hunks)
- packages/ee/server-only/limits/provider/client.tsx (2 hunks)
- packages/email/templates/recipient-removed-from-document.tsx (1 hunks)
- packages/lib/package.json (1 hunks)
- packages/lib/server-only/field/set-fields-for-document.ts (5 hunks)
- packages/lib/server-only/recipient/set-recipients-for-document.ts (6 hunks)
- packages/lib/translations/de/common.po (21 hunks)
- packages/lib/translations/de/marketing.js (1 hunks)
- packages/lib/translations/en/common.po (21 hunks)
- packages/lib/translations/en/marketing.js (1 hunks)
- packages/lib/utils/recipients.ts (1 hunks)
- packages/ui/primitives/document-flow/add-fields.tsx (5 hunks)
- packages/ui/primitives/document-flow/add-signers.tsx (15 hunks)
- packages/ui/primitives/document-flow/field-item.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/lib/translations/de/marketing.js
Additional comments not posted (60)
packages/lib/utils/recipients.ts (2)
6-18: LGTM!The
canRecipientBeModifiedfunction correctly implements the logic to determine if a recipient can be modified based on the provided conditions. The early return statements improve readability and performance.
27-33: LGTM!The
canRecipientFieldsBeModifiedfunction correctly builds upon thecanRecipientBeModifiedfunction and adds the additional check for the recipient's role. The logic is clear and concise.packages/lib/package.json (1)
51-51: Verify the impact of upgrading theremedalibrary.The
remedalibrary has been upgraded from version1.27.1to2.12.1. This is a major version upgrade and may introduce breaking changes.To assess the impact of this upgrade, run the following script:
If the script reveals any incompatible usages or potential issues, please update the code accordingly to align with the
remeda2.x API.Verification successful
The upgrade to remeda 2.12.1 appears to be safe.
Based on the analysis of the codebase, the upgrade from remeda 1.x to 2.12.1 should not introduce any breaking changes in your current usage. The functions you're using (prop, sortBy, and isDeepEqual) are not affected by the major version upgrade.
To ensure a smooth transition:
- Proceed with the upgrade to remeda 2.12.1.
- After upgrading, thoroughly test the following files that import remeda:
- packages/ui/primitives/document-flow/add-signers.tsx
- packages/ui/primitives/document-flow/add-fields.tsx
- packages/ee/server-only/limits/provider/client.tsx
- packages/lib/server-only/field/set-fields-for-document.ts
While the upgrade appears safe, it's always a good practice to run your test suite and perform manual testing to catch any unexpected issues.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: # - Verify the usage of the `remeda` library across the codebase. # - Check if the upgrade to version 2.x introduces any breaking changes. # Test 1: Search for `remeda` imports. # Expect: A list of files using the `remeda` library. echo "Files importing 'remeda':" rg --type typescript --files-with-matches $'from \'remeda\'' # Test 2: Search for specific `remeda` function usage that might be affected by breaking changes in 2.x. # Expect: No results or only valid usages according to the 2.x API. echo "\nChecking for potentially affected 'remeda' function usage..." # 2.1 Check for `R.pipe` usage (removed in 2.x) echo "Occurrences of 'R.pipe':" rg --type typescript -C 2 $'R\.pipe' # 2.2 Check for `R.pipeAsync` usage (removed in 2.x) echo "Occurrences of 'R.pipeAsync':" rg --type typescript -C 2 $'R\.pipeAsync' # Add more checks for other potentially affected functions... echo "Impact verification complete."Length of output: 668
Script:
#!/bin/bash # Description: # - Verify the usage of the `remeda` library across the codebase. # - Check if the upgrade to version 2.x introduces any breaking changes. # Test 1: Search for `remeda` imports in .ts, .tsx, and .js files echo "Files importing 'remeda':" rg --files-with-matches -g '*.{ts,tsx,js}' "from 'remeda'" # Test 2: Search for specific `remeda` function usage that might be affected by breaking changes in 2.x echo "\nChecking for potentially affected 'remeda' function usage..." # 2.1 Check for `R.pipe` usage (removed in 2.x) echo "Occurrences of 'R.pipe':" rg -C 2 -g '*.{ts,tsx,js}' 'R\.pipe' # 2.2 Check for `R.pipeAsync` usage (removed in 2.x) echo "Occurrences of 'R.pipeAsync':" rg -C 2 -g '*.{ts,tsx,js}' 'R\.pipeAsync' # 2.3 Check for `R.compact` usage (behavior changed in 2.x) echo "Occurrences of 'R.compact':" rg -C 2 -g '*.{ts,tsx,js}' 'R\.compact' echo "Impact verification complete."Length of output: 893
Script:
#!/bin/bash # Description: # - Inspect the content of files importing 'remeda' # - Check for usage of potentially affected functions in remeda 2.x echo "Inspecting files importing 'remeda':" files=( "packages/ui/primitives/document-flow/add-signers.tsx" "packages/ui/primitives/document-flow/add-fields.tsx" "packages/ee/server-only/limits/provider/client.tsx" "packages/lib/server-only/field/set-fields-for-document.ts" ) for file in "${files[@]}"; do echo "File: $file" echo "-------------------" rg -C 5 "from 'remeda'" "$file" echo -e "\n" done echo "Checking for potentially affected remeda functions:" echo "-------------------" # List of potentially affected functions in remeda 2.x affected_functions=( "R.omit" "R.pick" "R.pickBy" "R.mapKeys" "R.mergeAll" "R.zip" "R.zipWith" "R.zipObj" "R.unzip" ) for func in "${affected_functions[@]}"; do echo "Occurrences of '$func':" rg -C 2 -g '*.{ts,tsx,js}' "$func" echo -e "\n" done echo "Inspection complete."Length of output: 5212
apps/marketing/package.json (1)
37-37: Verify the impact of upgradingnext-axiomon the application.The
next-axiomlibrary has been upgraded from version1.1.1to1.5.1. While this change suggests improvements or bug fixes, it's crucial to ensure that the upgrade does not introduce any breaking changes or compatibility issues within the marketing application.To verify the impact, follow these steps:
Thoroughly review the release notes and changelog of
next-axiomfor versions1.2.0to1.5.1to identify any breaking changes or deprecations that may affect the application.Run the following script to search for usages of
next-axiomacross the codebase:For each usage found, verify that the implementation is compatible with the upgraded version and make necessary adjustments if required.
Perform comprehensive testing of the marketing application, focusing on areas that integrate with
next-axiom, to ensure that the functionality remains intact and no new issues are introduced due to the version upgrade.By following these verification steps, you can mitigate the risk of potential issues arising from the
next-axiomupgrade and ensure a smooth transition to the newer version.If you encounter any challenges or need assistance with the verification process, please let me know, and I'll be happy to provide further guidance.
Verification successful
Upgrade impact verified: Focus on
AxiomWebVitalsandwithAxiomThe
next-axiomupgrade from 1.1.1 to 1.5.1 affects both the marketing and web apps. The usage is consistent and minimal:
AxiomWebVitalscomponent in layout files:
- apps/marketing/src/app/layout.tsx
- apps/web/src/app/layout.tsx
withAxiomfunction in Next.js config:
- apps/marketing/next.config.js
- apps/web/next.config.js
To ensure compatibility:
- Check the
AxiomWebVitalscomponent usage in both layout files for any breaking changes or new props.- Verify the
withAxiomfunction in next.config.js files for any configuration changes.- Review the changelog for versions 1.2.0 to 1.5.1, focusing on these two main usage points.
The minimal and consistent usage reduces the risk of breaking changes, but thorough testing of both apps is still recommended.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for `next-axiom` imports rg --type typescript --type javascript 'from "next-axiom"' # Search for `next-axiom` configurations rg --type typescript --type javascript 'nextAxiom\('Length of output: 185
Script:
#!/bin/bash # Search for files with .js, .jsx, .ts, or .tsx extensions echo "Searching for 'next-axiom' imports and usage:" fd -e js -e jsx -e ts -e tsx | xargs rg -i "next-axiom" echo "\nSearching for 'nextAxiom' function calls:" fd -e js -e jsx -e ts -e tsx | xargs rg -i "nextAxiom\(" echo "\nSearching for any other 'next-axiom' references:" fd -e js -e jsx -e ts -e tsx -e json | xargs rg -i "next-axiom"Length of output: 1629
packages/ee/server-only/limits/provider/client.tsx (2)
45-45: LGTM!The usage of
isDeepEqualhere is appropriate and should provide a more accurate comparison of the old and new limits. This change aligns with the expected behavior of theLimitsProvidercomponent.
5-5: Verify the impact of theremedalibrary upgrade.The change from
equalstoisDeepEqualis likely due to an upgrade of theremedalibrary. While this change is generally positive, as it provides a more thorough comparison of limits, it's important to ensure that this change doesn't introduce any unintended side effects or break existing functionality.Run the following script to analyze the usage of
remedafunctions across the codebase:Verification successful
Verified:
remedaupgrade consistently applied andisDeepEqualusage is appropriateThe change from
equalstoisDeepEqualinpackages/ee/server-only/limits/provider/client.tsxis consistent with the usage in other parts of the codebase. TheisDeepEqualfunction is being used appropriately for comparing complex objects like limits and field metadata. There's no evidence of unintended side effects or broken functionality due to this change.Key observations:
isDeepEqualis used in two files:client.tsxandset-fields-for-document.ts- Other
remedafunctions (propandsortBy) are used consistently in other files- Remaining
equalsusage is not fromremeda, but likely from custom implementations or other librariesThe upgrade appears to have been applied consistently across the codebase, and the change is likely to provide more thorough comparisons as intended.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Analyze the usage of `remeda` functions. # Test 1: Search for `remeda` imports. Expect: Consistent version across all files. rg --type typescript $'from \'remeda\'' # Test 2: Search for `equals` usage. Expect: No occurrences, as it has been replaced. ast-grep --lang typescript --pattern $'equals($_)' # Test 3: Search for `isDeepEqual` usage. Expect: Usage in relevant comparison scenarios. ast-grep --lang typescript --pattern $'isDeepEqual($_, $_)'Length of output: 303
Script:
#!/bin/bash # Description: Further analyze the usage of `remeda` functions and imports # Search for `remeda` imports grep -r "from 'remeda'" --include="*.ts" --include="*.tsx" . # Double-check for any remaining `equals` usage grep -r "equals(" --include="*.ts" --include="*.tsx" . # Investigate `isDeepEqual` usage with context grep -r -n -C 3 "isDeepEqual(" --include="*.ts" --include="*.tsx" . # Search for other `remeda` function imports grep -r "import {.*} from 'remeda'" --include="*.ts" --include="*.tsx" .Length of output: 2624
apps/web/package.json (2)
56-56: Assess the impact of upgradingremedaon the application.The
remedalibrary has been upgraded from version^1.27.1to^2.12.1. This is a major version bump, which may introduce breaking changes or require modifications to the existing code that relies on this library.To assess the impact of the upgrade, run the following script:
If the library is used extensively or if the build fails, review the
remedachangelog and migration guide to identify and address any breaking changes or required code modifications.
40-40: Verify the impact of upgradingnext-axiomon the application.The
next-axiomlibrary has been upgraded from version^1.1.1to^1.5.1. While this update likely includes improvements and bug fixes, it's important to ensure that the new version is compatible with the application and doesn't introduce any breaking changes.To verify the impact of the upgrade, run the following script:
If the library is used extensively or if the build fails, consider reviewing the changelog and migration guide of
next-axiomto identify and address any potential issues.Verification successful
To gather the necessary information about the usage of
next-axiomin the codebase, I'll generate new shell scripts that should work in the given environment. These scripts will help us identify where and hownext-axiomis being used.These scripts should help us identify the usage of
next-axiomin the codebase, allowing us to better assess the potential impact of the upgrade.
The
next-axiomupgrade appears to have minimal impact on the application.The upgrade from version ^1.1.1 to ^1.5.1 is a minor version bump, which typically indicates backward-compatible changes. Based on the analysis:
next-axiomis primarily used for configuration (withAxiomin next.config.js) and web vitals tracking (AxiomWebVitalsin layout.tsx).- No direct usage of logging functions was found, suggesting limited use of advanced features.
- The new version (^1.5.1) is consistently applied across all relevant files.
To ensure a smooth upgrade:
- Review the
next-axiomchangelog for any new features or improvements that could benefit your application.- Perform basic testing of the application, focusing on areas that might interact with
next-axiom(e.g., performance monitoring, error tracking).- If you use any advanced features of
next-axiomnot detected in this analysis, pay extra attention to those during testing.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and compatibility of the `next-axiom` library. # Test 1: Search for the library's usage in the codebase. rg --type typescript -A 5 $'next-axiom' # Test 2: Check if the application builds successfully with the new version. npm run buildLength of output: 160
Script:
#!/bin/bash # Search for next-axiom usage in the codebase # Using ripgrep to find any mention of next-axiom echo "Searching for next-axiom mentions:" rg "next-axiom" -C 5 # Using ast-grep to find import statements for next-axiom echo "Searching for next-axiom import statements:" ast-grep --lang javascript --pattern 'import $_ from "next-axiom"' # Using ast-grep to find require statements for next-axiom echo "Searching for next-axiom require statements:" ast-grep --lang javascript --pattern 'const $_ = require("next-axiom")' # Search for specific next-axiom function calls or usage echo "Searching for specific next-axiom usage:" rg "withAxiom|log\.(debug|info|warn|error)" -C 5Length of output: 8948
packages/email/templates/recipient-removed-from-document.tsx (3)
21-25: LGTM!The component props and their default values are properly defined.
32-76: LGTM!The component structure and styling look good. The use of imported components and Tailwind CSS classes ensures a consistent and visually appealing email template.
1-1: Verify the import path for the Tailwind config.Ensure that the import path
@documenso/tailwind-configis correct and the package is properly installed in the project.Run the following script to verify the import:
Verification successful
Import path for Tailwind config is correct
The import statement
import config from '@documenso/tailwind-config';inpackages/email/templates/recipient-removed-from-document.tsxis correct. The package@documenso/tailwind-configexists as a local package within the monorepo and is properly referenced in multiplepackage.jsonfiles across the project.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the import path for the Tailwind config. # Test: Check if the package exists. Expect: Package found. fd --type file --regex '.*@documenso/tailwind-config.*'Length of output: 57
Script:
#!/bin/bash # Description: Verify the Tailwind config import and search for related files # Search for the specific import statement in the file echo "Searching for import statement:" rg "import .* from '@documenso/tailwind-config'" packages/email/templates/recipient-removed-from-document.tsx # Search for any occurrences of 'tailwind-config' in the codebase echo "Searching for tailwind-config in the codebase:" rg "tailwind-config" -l # Check package.json files for references to tailwind-config echo "Checking package.json files:" fd package.json --exec rg "tailwind-config" {}Length of output: 2124
packages/ui/primitives/document-flow/field-item.tsx (2)
213-213: LGTM!The addition of the
data-field-idattribute is a good practice for improving the component's accessibility and integration with other parts of the application. It provides a unique identifier for the field item, which can be useful for DOM interactions and JavaScript functionalities that rely on data attributes.
Line range hint
1-212: Verify the impact of thedata-field-idattribute on the codebase.The addition of the
data-field-idattribute is a minor change that should not affect the existing functionality. However, it's important to ensure that this change does not introduce any unintended consequences or break any existing code that relies on theFieldItemcomponent.To verify the impact, run the following script:
If the above tests pass without any issues, it indicates that the
data-field-idattribute addition is safe and does not introduce any breaking changes.Also applies to: 214-285
packages/lib/server-only/recipient/set-recipients-for-document.ts (5)
278-308: Excellent addition of email notifications for removed recipients!Sending email notifications to recipients who have been removed from the document is a thoughtful feature. It keeps them informed about the changes and provides transparency.
The implementation looks solid:
- It correctly checks if the recipient had been sent the document before sending the notification.
- It uses the
RecipientRemovedFromDocumentTemplateto generate the email content.- It passes the necessary data to the template.
- It sends the email using the configured
mailerservice.
63-65: Ensure the includedFielddata is used efficiently.The code includes the
Fieldrelation when querying the document:include: { Field: true, },However, it's unclear if all the fields of the
Fieldrelation are necessary for the current operation. Fetching unnecessary data can impact performance.Please review the usage of the
Fielddata and consider:
- If all the fetched fields are actually used in the code.
- If any specific fields can be selected instead of fetching the entire
Fieldobject.To verify the usage of the
Fielddata, run the following script:Review the results and optimize the
Fielddata fetching if necessary.Verification successful
The inclusion of
Fielddata appears necessary and efficiently used.After reviewing the code, the inclusion of the
Fieldrelation in the document query is justified. Here's why:
- The
document.Fieldis used in thecanRecipientBeModifiedfunction, which checks if a recipient can be modified based on the document's fields.- There's no evidence of unnecessary data fetching or inefficient use of the
Fielddata.- The code handles field deletion for specific recipient role changes, indicating careful management of field data.
Given these observations, the current implementation seems appropriate for the use case. No changes are required at this time.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `Field` data. # Test: Search for the usage of the `Field` relation. # Expect: The fetched fields should be used efficiently in the code. rg --type typescript -A 10 $'document.Field'Length of output: 78
Script:
#!/bin/bash # Description: Verify the usage of the `Field` data. # Search for usage of document.Field and document?.Field across all files echo "Searching for document.Field usage:" rg -i -C 5 'document\.Field|document\?\.Field' # Search for Field usage in the specific file under review echo "Searching for Field usage in the specific file:" rg -i -C 5 'Field' packages/lib/server-only/recipient/set-recipients-for-document.tsLength of output: 2353
326-348: Ensure all relevant recipient fields are compared.The
hasRecipientBeenChangedfunction compares the relevant fields of the existing recipient with the new recipient data to determine if any changes have occurred. This is crucial for validating recipient modifications.Please verify that all the fields that should be compared are included in this function. If any field is missing, it could lead to incorrect change detection.
To verify that all relevant fields are compared, run the following script:
Compare the fields being compared in
hasRecipientBeenChangedwith the fields defined in theRecipientDatatype. If any field is missing, please add it to the comparison.Verification successful
All relevant recipient fields are being compared.
The
hasRecipientBeenChangedfunction compares all the essential fields from theRecipientDatatype:
- name
- role
- signingOrder
- actionAuth
The
idfield is not compared, but this is likely intentional as it's an optional field and may not be relevant for determining if the recipient's details have changed.The implementation appears to be consistent with the comment above the
RecipientDatatype, which suggests updating the function when the type changes.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all relevant recipient fields are compared in `hasRecipientBeenChanged`. # Test: Search for the `hasRecipientBeenChanged` function. # Expect: It should compare all the fields present in the `RecipientData` type. rg --type typescript -A 20 $'hasRecipientBeenChanged'Length of output: 87
Script:
#!/bin/bash # Search for RecipientData type and hasRecipientBeenChanged function rg -A 20 'type RecipientData' rg -A 20 'const hasRecipientBeenChanged'Length of output: 3230
123-144: Verify the logic for handling existing recipients.The code correctly handles existing recipients by checking if they have been modified and if they can be modified based on their interaction with the document. It throws an appropriate error if an invalid modification is attempted.
To verify the logic, run the following script:
Verification successful
Verification of recipient modification logic is successful.
The implementation in
packages/lib/server-only/recipient/set-recipients-for-document.tscorrectly handles existing recipients:
- It checks if the recipient has been changed.
- It verifies if the recipient can be modified using
canRecipientBeModified(existing, document.Field).- If modification is not allowed, it throws an
AppErrorwithAppErrorCode.INVALID_REQUESTand an appropriate message.This logic is consistent with the usage of
canRecipientBeModifiedthroughout the codebase, ensuring that recipients who have already interacted with the document cannot be modified.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the logic for handling existing recipients. # Test 1: Search for the `canRecipientBeModified` function usage. # Expect: It should be called with the correct arguments. rg --type typescript -A 5 $'canRecipientBeModified' # Test 2: Search for the error thrown when a recipient cannot be modified. # Expect: The error should have the correct code and message. rg --type typescript -A 5 $'AppErrorCode.INVALID_REQUEST'Length of output: 177
Script:
#!/bin/bash # Description: Verify the logic for handling existing recipients. # Test 1: Search for the `canRecipientBeModified` function usage. rg -A 5 'canRecipientBeModified' # Test 2: Search for the error thrown when a recipient cannot be modified. rg -A 5 'AppErrorCode.INVALID_REQUEST' # Test 3: Use ast-grep to find the specific function call pattern ast-grep --lang javascript --pattern 'canRecipientBeModified($_, $_)' # Test 4: Use ast-grep to find the error throwing pattern ast-grep --lang javascript --pattern 'throw new AppError(AppErrorCode.INVALID_REQUEST, $_)'Length of output: 23699
4-6: Verify the imported email templates and services are used correctly.The code imports the following email-related modules:
mailerfrom@documenso/email/mailerrenderfrom@documenso/email/renderRecipientRemovedFromDocumentTemplatefrom@documenso/email/templates/recipient-removed-from-documentPlease ensure that:
- The
mailerservice is properly configured and can send emails.- The
renderfunction is used correctly to generate the email content.- The
RecipientRemovedFromDocumentTemplateis the correct template for notifying removed recipients.To verify the usage of the imported email modules, run the following script:
Review the results to ensure the imported modules are used correctly. If any discrepancies are found, please investigate and fix them.
Verification successful
Verified: Email templates and services are used correctly.
The imported email-related modules are used appropriately throughout the codebase:
- The
mailerservice is properly configured and used to send emails with correct arguments.- The
renderfunction is consistently used to generate both HTML and plain text versions of email content.- The
RecipientRemovedFromDocumentTemplateis correctly imported and used for notifying removed recipients.No issues were found, and the implementation appears to be correct and consistent.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the imported email modules. # Test 1: Search for the usage of the `mailer` service. # Expect: It should be used to send emails with the correct arguments. rg --type typescript -A 10 $'mailer.sendMail' # Test 2: Search for the usage of the `render` function. # Expect: It should be used to generate the email content with the correct arguments. rg --type typescript -A 5 $'render\(' # Test 3: Search for the usage of the `RecipientRemovedFromDocumentTemplate`. # Expect: It should be used as the template for removed recipient notifications. rg --type typescript -A 5 $'RecipientRemovedFromDocumentTemplate'Length of output: 253
Script:
#!/bin/bash # Description: Verify the usage of the imported email modules using fd and grep. # Test 1: Search for the usage of the `mailer` service. echo "Searching for mailer.sendMail usage:" fd -e ts -e tsx | xargs grep -ni -A 10 "mailer\.sendMail" || echo "No matches found for mailer.sendMail" # Test 2: Search for the usage of the `render` function. echo "Searching for render function usage:" fd -e ts -e tsx | xargs grep -ni -A 5 "render(" || echo "No matches found for render(" # Test 3: Search for the usage of the `RecipientRemovedFromDocumentTemplate`. echo "Searching for RecipientRemovedFromDocumentTemplate usage:" fd -e ts -e tsx | xargs grep -ni -A 5 "RecipientRemovedFromDocumentTemplate" || echo "No matches found for RecipientRemovedFromDocumentTemplate"Length of output: 34959
packages/lib/server-only/field/set-fields-for-document.ts (3)
98-127: Ensure recipient existence and field modification validity.The changes introduce important validation checks:
- Each field must have an associated recipient. If a recipient is not found, an error is thrown.
- If a field has been modified and the recipient's status does not allow field modifications, an error is thrown.
These checks enhance the robustness of the function by preventing invalid field modifications.
110-120: Verify error handling for recipient interaction check.The code introduces a check to prevent modifying a field if the recipient has already interacted with the document. This is a crucial validation to maintain data integrity.
Please ensure that this error is properly handled and communicated to the user in a clear and actionable manner. Consider testing various scenarios where a recipient has interacted with the document to confirm that the error is thrown correctly and the user receives an appropriate message.
354-367: VerifyhasFieldBeenChangedusage across the codebase.The new
hasFieldBeenChangedfunction compares the current and new field data to determine if a field has been modified. This is a critical piece of logic that affects the behavior of thesetFieldsForDocumentfunction.Please ensure that this function is used consistently and correctly throughout the codebase, especially in any other places where field modifications are handled.
Run the following script to verify the usage of
hasFieldBeenChanged:Verification successful
Verified:
hasFieldBeenChangedis used correctly and consistentlyThe
hasFieldBeenChangedfunction is used appropriately within thesetFieldsForDocumentfunction in the same file. It's utilized to check if an existing field has been modified before applying changes, which is crucial for preventing modifications to fields where recipients have already interacted with the document.Key observations:
- The function is only used locally within the file, which is suitable for its purpose.
- There's a helpful comment above the
FieldDatatype definition, indicating that thehasFieldBeenChangedfunction should be updated if the type changes.No issues were found with the implementation or usage of the
hasFieldBeenChangedfunction.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of `hasFieldBeenChanged` function across the codebase. # Test: Search for the function usage. Expect: Only valid usage patterns. rg --type typescript -A 5 $'hasFieldBeenChanged'Length of output: 82
Script:
#!/bin/bash # Description: Search for usage of `hasFieldBeenChanged` function in TypeScript files # Find all TypeScript files and search for 'hasFieldBeenChanged' fd -e ts -x grep -n -A 5 'hasFieldBeenChanged' {} || echo "No matches found" # Additionally, let's check the content of the file we're reviewing cat packages/lib/server-only/field/set-fields-for-document.tsLength of output: 11877
packages/lib/translations/en/marketing.js (2)
1-1: LGTM!The changes to the
messagesobject look good. The JSON structure is valid and the modifications enhance clarity and expand functionality.
1-1: Verify the impact of localization changes.The changes to the localization strings can potentially impact the user experience across the application. It's crucial to thoroughly test the affected user flows to ensure that the modifications are rendering correctly and conveying the intended meaning effectively.
Run the following script to identify the usage of the modified keys across the codebase:
Review the results to assess the impact and plan comprehensive testing of the affected areas.
packages/ui/primitives/document-flow/add-signers.tsx (14)
19-19: LGTM!The import statement for
canRecipientBeModifiedutility function is correct.
Line range hint
191-198: Verify the error handling for removing a signer.The code correctly prevents removing a signer who has already signed the document and displays an appropriate error message using the
toastfunction.
237-238: Verify the logic for updating signing orders.The code correctly updates the signing orders of the remaining signers when a signer is removed, considering the
canRecipientBeModifiedstatus of each signer.
272-272: Verify theonDragEndcallback dependencies.The
onDragEndcallback has the correct dependencies in its dependency array, including theform,canRecipientBeModified, andwatchedSigners.
317-329: Verify the logic for updating signing orders during drag and drop.The code correctly updates the signing orders of the signers when they are reordered using drag and drop, considering the
canRecipientBeModifiedstatus of each signer.
338-338: Verify theupdateSigningOrderscallback dependencies.The
updateSigningOrderscallback has the correct dependencies in its dependency array, including theformandcanRecipientBeModified.
429-429: Verify the logic for disabling drag and drop.The code correctly disables drag and drop for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
445-445: Verify the logic for disabling the signer form fields.The code correctly disables the signer form fields for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
478-478: Verify the logic for disabling the signing order input.The code correctly disables the signing order input for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
512-512: Verify the logic for disabling the email input.The code correctly disables the email input for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
546-546: Verify the logic for disabling the name input.The code correctly disables the name input for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
574-574: Verify the logic for disabling the action auth select.The code correctly disables the action auth select for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
597-597: Verify the logic for disabling the recipient role select.The code correctly disables the recipient role select for signers who cannot be modified based on the
canRecipientBeModifiedfunction.
613-614: Verify the logic for disabling the remove signer button.The code correctly disables the remove signer button for signers who cannot be modified based on the
canRecipientBeModifiedfunction and when there is only one signer remaining.packages/lib/translations/en/common.po (20)
80-80: LGTM!The translation for "Add myself" is correct.
92-92: LGTM!The translation for "Add Signer" is correct.
113-113: LGTM!The translation for "Advanced settings" is correct.
176-176: LGTM!The translation for "Checkbox" is correct.
222-222: LGTM!The translation for "Date" is correct.
254-254: LGTM!The translation for "Dropdown" is correct.
Line range hint
263-269: LGTM!The translations for "Email" and "Name" are correct.
280-280: LGTM!The translation for "Enable signing order" is correct.
382-385: LGTM!The translations for "Name" are correct.
404-404: LGTM!The translation for "No recipient matching this description was found." is correct.
409-409: LGTM!The translation for "No recipients with this role" is correct.
434-434: LGTM!The translation for "Number" is correct.
469-469: LGTM!The translation for "Radio" is correct.
505-505: LGTM!The translation for "Remove" is correct.
567-567: LGTM!The translation for "Show advanced settings" is correct.
576-576: LGTM!The translation for "Signature" is correct.
624-624: LGTM!The translation for "Text" is correct.
685-685: LGTM!The translation for "This document has already been sent to this recipient. You can no longer edit this recipient." is correct.
697-699: LGTM!The new translation "This recipient can no longer be modified as they have signed a field, or completed the document." is correct.
722-722: LGTM!The translation for "To proceed further, please set at least one value for the {0} field." is correct.
packages/ui/primitives/document-flow/add-fields.tsx (3)
231-237: Verify the logic for determining if fields are disabled.The
isFieldsDisabledvariable is now determined using thecanRecipientFieldsBeModifiedfunction, which checks if the selected recipient can modify fields based on their current state. This improves the clarity and maintainability of the code.
35-38: Verify the usage of the imported utility functions.The imported utility functions
canRecipientBeModifiedandcanRecipientFieldsBeModifiedare used to determine if a recipient can be modified or if their fields can be modified. Ensure that these functions are being used correctly throughout the codebase.Run the following script to verify the usage of these functions:
Verification successful
Verification of imported utility functions successful
The imported utility functions
canRecipientBeModifiedandcanRecipientFieldsBeModifiedare being used correctly throughout the codebase. Key observations:
- Both functions are defined in
packages/lib/utils/recipients.tsand imported where needed.canRecipientBeModifiedis extensively used in UI components, particularly inadd-signers.tsxandadd-fields.tsx, to control UI interactions and form submissions based on recipient modifiability.canRecipientFieldsBeModifiedis used inadd-fields.tsxand server-side logic inset-fields-for-document.tsto manage field modifications.- The usage is consistent across client-side and server-side code, ensuring uniform behavior in recipient and field modification checks.
The implementation and usage of these functions appear to be correct and in line with their intended purpose of managing recipient and field modifications in the document flow.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `canRecipientBeModified` and `canRecipientFieldsBeModified` functions. # Test 1: Search for the usage of `canRecipientBeModified`. # Expect: Should be used with a recipient object and a fields array. rg --type typescript -A 5 $'canRecipientBeModified' # Test 2: Search for the usage of `canRecipientFieldsBeModified`. # Expect: Should be used with a recipient object and a fields array. rg --type typescript -A 5 $'canRecipientFieldsBeModified'Length of output: 177
Script:
#!/bin/bash # Search for usage of canRecipientBeModified echo "Usage of canRecipientBeModified:" rg 'canRecipientBeModified' -g '*.{ts,tsx}' -A 5 echo "\nUsage of canRecipientFieldsBeModified:" rg 'canRecipientFieldsBeModified' -g '*.{ts,tsx}' -A 5 echo "\nDefinition of canRecipientBeModified:" ast-grep --lang typescript --pattern 'export function canRecipientBeModified($_) { $$$ }' echo "\nDefinition of canRecipientFieldsBeModified:" ast-grep --lang typescript --pattern 'export function canRecipientFieldsBeModified($_) { $$$ }'Length of output: 17626
576-577: Verify the usage ofcanRecipientBeModifiedfunction.The
canRecipientBeModifiedfunction is used to determine if a field should be disabled based on the selected recipient's ability to be modified. Ensure that this function is being used correctly and consistently throughout the codebase.Run the following script to verify the usage of this function:
Verification successful
To gather the necessary information for verifying the usage of
canRecipientBeModified, I'll generate new shell scripts to search for its usage and definition.
Based on the analysis of the
canRecipientBeModifiedfunction usage across the codebase, I can provide a final response to the review comment.Verified:
canRecipientBeModifiedfunction is used correctly and consistently.The
canRecipientBeModifiedfunction is defined inpackages/lib/utils/recipients.tsand takes two parameters:recipientandfields. Its usage in the file under review (packages/ui/primitives/document-flow/add-fields.tsx) is correct, as it's called with bothselectedSignerandfieldsas arguments.This usage is consistent with other occurrences in the codebase, such as in:
- packages/ui/primitives/document-flow/add-signers.tsx
- packages/lib/server-only/recipient/set-recipients-for-document.ts
The function is properly imported and utilized in various components and utilities, demonstrating good code organization and reusability.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `canRecipientBeModified` function. # Test: Search for the usage of `canRecipientBeModified`. # Expect: Should be used with a recipient object and a fields array. rg --type typescript -A 5 $'canRecipientBeModified'Length of output: 85
Script:
#!/bin/bash # Search for usage of canRecipientBeModified in .ts and .tsx files echo "Searching for canRecipientBeModified usage:" fd -e ts -e tsx --exec grep -n "canRecipientBeModified" {} + # Search for the definition of canRecipientBeModified echo -e "\nSearching for canRecipientBeModified definition:" fd -e ts -e tsx --exec grep -n "function canRecipientBeModified" {} +Length of output: 72585
| import { type Field, type Recipient, RecipientRole, SigningStatus } from '@documenso/prisma/client'; | ||
|
|
||
| /** | ||
| * Whether a recipient can be modified by the document owner. | ||
| */ | ||
| export const canRecipientBeModified = (recipient: Recipient, fields: Field[]) => { | ||
| // Deny if the recipient has already signed the document. | ||
| if (!recipient || recipient.signingStatus === SigningStatus.SIGNED) { | ||
| return false; | ||
| } | ||
|
|
||
| // Deny if the recipient has inserted any fields. | ||
| if (fields.some((field) => field.recipientId === recipient.id && field.inserted)) { | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| }; | ||
|
|
||
| /** | ||
| * Whether a recipient can have their fields modified by the document owner. | ||
| * | ||
| * A recipient can their fields modified if all the conditions are met: | ||
| * - They are not a Viewer or CCer | ||
| * - They can be modified (canRecipientBeModified) | ||
| */ | ||
| export const canRecipientFieldsBeModified = (recipient: Recipient, fields: Field[]) => { | ||
| if (!canRecipientBeModified(recipient, fields)) { | ||
| return false; | ||
| } | ||
|
|
||
| return recipient.role !== RecipientRole.VIEWER && recipient.role !== RecipientRole.CC; | ||
| }; |
There was a problem hiding this comment.
Tip
Codebase Verification
Utility functions are used, but manual checks still exist
The utility functions canRecipientBeModified and canRecipientFieldsBeModified are being used in multiple files across the codebase, including UI components and server-side logic. However, there are still instances of manual checks for recipient roles, signing status, and field insertion. Consider reviewing the following:
- Examine manual implementations in server-side logic (e.g., in
packages/lib/server-only/directory) to determine if they can be replaced with the utility functions. - Review specific use cases in UI components (e.g., in
apps/web/src/app/directory) where manual checks are still being performed. - Evaluate if the remaining manual implementations serve a specific purpose that the utility functions don't cover.
Consistent use of these utility functions could improve code maintainability and reduce the risk of inconsistent behavior.
Analysis chain
Verify the usage of these utility functions.
The introduced utility functions encapsulate the logic for determining the modifiability of recipients and their fields. It's important to ensure that these functions are being used consistently throughout the codebase wherever recipient modification checks are required.
Run the following script to verify the usage of these utility functions:
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the usage of `canRecipientBeModified` and `canRecipientFieldsBeModified` functions.
# Test 1: Search for manual checks on recipient's signing status or field insertion.
# Expect: No occurrences of manual checks, only usage of the utility functions.
rg --type typescript -A 5 $'recipient\.signingStatus|field\.recipientId.*field\.inserted'
# Test 2: Search for manual checks on recipient's role.
# Expect: No occurrences of manual role checks, only usage of the utility functions.
rg --type typescript -A 5 $'recipient\.role.*RecipientRole\.(VIEWER|CC)'
Length of output: 234
Script:
#!/bin/bash
# Description: Verify the usage of canRecipientBeModified and canRecipientFieldsBeModified functions
# Search for usage of canRecipientBeModified
echo "Searching for usage of canRecipientBeModified:"
rg "canRecipientBeModified" -n
echo "\nSearching for usage of canRecipientFieldsBeModified:"
rg "canRecipientFieldsBeModified" -n
echo "\nSearching for imports of these functions:"
rg "import.*canRecipientBeModified|import.*canRecipientFieldsBeModified" -n
echo "\nSearching for potential manual implementations:"
rg "recipient\.signingStatus.*SigningStatus\.SIGNED|field\.recipientId.*field\.inserted|recipient\.role.*(RecipientRole\.VIEWER|RecipientRole\.CC)" -n
Length of output: 9970
| msgstr "" | ||
|
|
||
| #: packages/ui/primitives/document-flow/add-signers.tsx:653 | ||
| #: packages/ui/primitives/document-flow/add-signers.tsx:662 |
There was a problem hiding this comment.
Übersetzung für "Add myself" fehlt.
Die Übersetzung für die Zeichenfolge "Add myself" fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "Add myself"
msgstr "Mich selbst hinzufügen"
| msgstr "" | ||
|
|
||
| #: packages/ui/primitives/document-flow/add-signers.tsx:642 | ||
| #: packages/ui/primitives/document-flow/add-signers.tsx:651 |
There was a problem hiding this comment.
Übersetzung für "Add Signer" fehlt.
Die Übersetzung für die Zeichenfolge "Add Signer" fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "Add Signer"
msgstr "Unterzeichner hinzufügen"
| msgstr "" | ||
|
|
||
| #: packages/ui/primitives/document-flow/add-fields.tsx:522 | ||
| #: packages/ui/primitives/document-flow/add-fields.tsx:527 |
There was a problem hiding this comment.
Übersetzung für "Advanced settings" fehlt.
Die Übersetzung für die Zeichenfolge "Advanced settings" fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "Advanced settings"
msgstr "Erweiterte Einstellungen"
| msgstr "" | ||
|
|
||
| #: packages/ui/primitives/document-flow/add-signers.tsx:194 | ||
| #: packages/ui/primitives/document-flow/add-signers.tsx:193 |
There was a problem hiding this comment.
Übersetzung für "Cannot remove signer" fehlt.
Die Übersetzung für die Zeichenfolge "Cannot remove signer" fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "Cannot remove signer"
msgstr "Unterzeichner kann nicht entfernt werden"
| #: packages/ui/primitives/document-flow/add-fields.tsx:1007 | ||
| msgid "This recipient can no longer be modified as they have signed a field, or completed the document." | ||
| msgstr "" |
There was a problem hiding this comment.
Übersetzung für "This recipient can no longer be modified as they have signed a field, or completed the document." fehlt.
Die Übersetzung für die Zeichenfolge "This recipient can no longer be modified as they have signed a field, or completed the document." fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "This recipient can no longer be modified as they have signed a field, or completed the document."
msgstr "Dieser Empfänger kann nicht mehr geändert werden, da er ein Feld unterschrieben oder das Dokument abgeschlossen hat."
| #: packages/ui/primitives/document-flow/add-signers.tsx:165 | ||
| #~ msgid "This signer has already received the document." | ||
| #~ msgstr "Dieser Unterzeichner hat das Dokument bereits erhalten." | ||
|
|
There was a problem hiding this comment.
Entfernen Sie die auskommentierte Übersetzung.
Die Übersetzung für "This signer has already received the document." ist auskommentiert und sollte entfernt werden, da sie nicht mehr verwendet wird.
Entfernen Sie die folgenden Zeilen:
#~ msgid "This signer has already received the document."
#~ msgstr "Dieser Unterzeichner hat das Dokument bereits erhalten."
| #: packages/ui/primitives/document-flow/add-signers.tsx:194 | ||
| msgid "This signer has already signed the document." |
There was a problem hiding this comment.
Übersetzung für "This signer has already signed the document." fehlt.
Die Übersetzung für die Zeichenfolge "This signer has already signed the document." fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "This signer has already signed the document."
msgstr "Dieser Unterzeichner hat das Dokument bereits unterschrieben."
| msgstr "" | ||
|
|
||
| #: packages/ui/primitives/document-flow/add-fields.tsx:983 | ||
| #: packages/ui/primitives/document-flow/add-fields.tsx:990 |
There was a problem hiding this comment.
Übersetzung für "To proceed further, please set at least one value for the {0} field." fehlt.
Die Übersetzung für die Zeichenfolge "To proceed further, please set at least one value for the {0} field." fehlt in der deutschen Lokalisierungsdatei.
Fügen Sie die folgende Übersetzung hinzu:
msgid "To proceed further, please set at least one value for the {0} field."
msgstr "Um fortzufahren, legen Sie bitte mindestens einen Wert für das {0}-Feld fest."
| const canRecipientBeModified = (recipientId?: number) => { | ||
| if (recipientId === undefined) { | ||
| return true; | ||
| } | ||
|
|
||
| return recipients.some( | ||
| (recipient) => | ||
| recipient.id === id && | ||
| recipient.sendStatus === SendStatus.SENT && | ||
| recipient.role !== RecipientRole.CC, | ||
| ); | ||
| }, | ||
| [recipients], | ||
| ); | ||
| const recipient = recipients.find((recipient) => recipient.id === recipientId); | ||
|
|
||
| if (!recipient) { | ||
| return false; | ||
| } | ||
|
|
||
| return utilCanRecipientBeModified(recipient, fields); | ||
| }; |
There was a problem hiding this comment.
Refactor the canRecipientBeModified function.
The canRecipientBeModified function can be simplified by using the utilCanRecipientBeModified utility function directly, without the need for additional checks.
Apply this diff to refactor the function:
-const canRecipientBeModified = (recipientId?: number) => {
- if (recipientId === undefined) {
- return true;
- }
-
- const recipient = recipients.find((recipient) => recipient.id === recipientId);
-
- if (!recipient) {
- return false;
- }
-
- return utilCanRecipientBeModified(recipient, fields);
-};
+const canRecipientBeModified = (recipientId?: number) => {
+ const recipient = recipients.find((recipient) => recipient.id === recipientId);
+ return recipient ? utilCanRecipientBeModified(recipient, fields) : true;
+};Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const canRecipientBeModified = (recipientId?: number) => { | |
| if (recipientId === undefined) { | |
| return true; | |
| } | |
| return recipients.some( | |
| (recipient) => | |
| recipient.id === id && | |
| recipient.sendStatus === SendStatus.SENT && | |
| recipient.role !== RecipientRole.CC, | |
| ); | |
| }, | |
| [recipients], | |
| ); | |
| const recipient = recipients.find((recipient) => recipient.id === recipientId); | |
| if (!recipient) { | |
| return false; | |
| } | |
| return utilCanRecipientBeModified(recipient, fields); | |
| }; | |
| const canRecipientBeModified = (recipientId?: number) => { | |
| const recipient = recipients.find((recipient) => recipient.id === recipientId); | |
| return recipient ? utilCanRecipientBeModified(recipient, fields) : true; | |
| }; |
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:
Summary by CodeRabbit
Release Notes
New Features
Improvements
Dependency Updates
next-axiomandremedalibraries to their latest versions, potentially enhancing performance and stability.