Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: merge PR #2069 fixes for allow/deny list sync issues
Cursor Agent9352c1aece1a
diff --git a/components/links/link-sheet/allow-list-section.tsx b/components/links/link-sheet/allow-list-section.tsxindex e16e8540..7b7b3033 100644--- a/components/links/link-sheet/allow-list-section.tsx+++ b/components/links/link-sheet/allow-list-section.tsx@@ -53,16 +53,15 @@ export default function AllowListSection({);useEffect(() => {- // Update the allowList in the data state when their inputs change- const newAllowList = sanitizeList(allowListInput);- setEnabled((prevEnabled) => prevEnabled && emailProtected);- setData((prevData) => ({- ...prevData,- allowList: emailProtected && enabled ? newAllowList : [],- visitorGroupIds:- emailProtected && enabled ? prevData.visitorGroupIds : [],- }));- }, [allowListInput, emailProtected, enabled, setData]);+ if (!emailProtected && enabled) {+ setEnabled(false);+ setData((prevData) => ({+ ...prevData,+ allowList: [],+ visitorGroupIds: [],+ }));+ }+ }, [emailProtected, enabled, setData]);useEffect(() => {if (isAllowed && presets?.allowList && presets.allowList.length > 0) {@@ -94,7 +93,15 @@ export default function AllowListSection({const handleAllowListChange = (event: React.ChangeEvent<HTMLTextAreaElement>,) => {- setAllowListInput(event.target.value);+ const updatedAllowListInput = event.target.value;+ setAllowListInput(updatedAllowListInput);++ if (emailProtected && enabled) {+ setData((prevData) => ({+ ...prevData,+ allowList: sanitizeList(updatedAllowListInput),+ }));+ }};const toggleVisitorGroup = (groupId: string) => {diff --git a/components/links/link-sheet/deny-list-section.tsx b/components/links/link-sheet/deny-list-section.tsxindex 8b9f188b..7c9a2181 100644--- a/components/links/link-sheet/deny-list-section.tsx+++ b/components/links/link-sheet/deny-list-section.tsx@@ -40,14 +40,14 @@ export default function DenyListSection({);useEffect(() => {- // Update the denyList in the data state when their inputs change- const newDenyList = sanitizeList(denyListInput);- setEnabled((prevEnabled) => prevEnabled && emailProtected);- setData((prevData) => ({- ...prevData,- denyList: emailProtected && enabled ? newDenyList : [],- }));- }, [denyListInput, enabled, emailProtected, setData]);+ if (!emailProtected && enabled) {+ setEnabled(false);+ setData((prevData) => ({+ ...prevData,+ denyList: [],+ }));+ }+ }, [emailProtected, enabled, setData]);useEffect(() => {if (isAllowed && presets?.denyList && presets.denyList.length > 0) {@@ -78,7 +78,15 @@ export default function DenyListSection({const handleDenyListChange = (event: React.ChangeEvent<HTMLTextAreaElement>,) => {- setDenyListInput(event.target.value);+ const updatedDenyListInput = event.target.value;+ setDenyListInput(updatedDenyListInput);++ if (emailProtected && enabled) {+ setData((prevData) => ({+ ...prevData,+ denyList: sanitizeList(updatedDenyListInput),+ }));+ }};return (diff --git a/components/links/link-sheet/link-options.tsx b/components/links/link-sheet/link-options.tsxindex c26e29bd..6627f74d 100644--- a/components/links/link-sheet/link-options.tsx+++ b/components/links/link-sheet/link-options.tsx@@ -146,6 +146,7 @@ export const LinkOptions = ({{data.audienceType === LinkAudienceType.GENERAL ? (<><AllowListSection+ key={`allow-list-${data.id ?? "new"}`}{...{ data, setData }}isAllowed={isTrial ||@@ -158,6 +159,7 @@ export const LinkOptions = ({presets={currentPreset}/><DenyListSection+ key={`deny-list-${data.id ?? "new"}`}{...{ data, setData }}isAllowed={isTrial ||