Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: allow/deny lists without verification

Marc Seitz0ed6d87e5aaa
diff --git a/components/links/link-sheet/allow-list-section.tsx b/components/links/link-sheet/allow-list-section.tsx
index d875c0fc..ef2bf54b 100644
--- a/components/links/link-sheet/allow-list-section.tsx
+++ b/components/links/link-sheet/allow-list-section.tsx
@@ -26,7 +26,7 @@ export default function AllowListSection({
plan,
}: LinkUpgradeOptions) => void;
}) {
- const { emailAuthenticated, allowList } = data;
+ const { emailProtected, allowList } = data;
// Initialize enabled state based on whether allowList is not null and not empty
const [enabled, setEnabled] = useState<boolean>(
@@ -39,12 +39,12 @@ export default function AllowListSection({
useEffect(() => {
// Update the allowList in the data state when their inputs change
const newAllowList = sanitizeAllowDenyList(allowListInput);
- setEnabled((prevEnabled) => prevEnabled && emailAuthenticated);
+ setEnabled((prevEnabled) => prevEnabled && emailProtected);
setData((prevData) => ({
...prevData,
- allowList: emailAuthenticated && enabled ? newAllowList : [],
+ allowList: emailProtected && enabled ? newAllowList : [],
}));
- }, [allowListInput, enabled, emailAuthenticated, setData]);
+ }, [allowListInput, emailProtected, enabled, setData]);
const handleEnableAllowList = () => {
const updatedEnabled = !enabled;
diff --git a/components/links/link-sheet/deny-list-section.tsx b/components/links/link-sheet/deny-list-section.tsx
index d5806374..93a93a96 100644
--- a/components/links/link-sheet/deny-list-section.tsx
+++ b/components/links/link-sheet/deny-list-section.tsx
@@ -26,7 +26,7 @@ export default function DenyListSection({
plan,
}: LinkUpgradeOptions) => void;
}) {
- const { emailAuthenticated, denyList } = data;
+ const { emailProtected, denyList } = data;
// Initialize enabled state based on whether denyList is not null and not empty
const [enabled, setEnabled] = useState<boolean>(
!!denyList && denyList.length > 0,
@@ -38,12 +38,12 @@ export default function DenyListSection({
useEffect(() => {
// Update the denyList in the data state when their inputs change
const newDenyList = sanitizeAllowDenyList(denyListInput);
- setEnabled((prevEnabled) => prevEnabled && emailAuthenticated);
+ setEnabled((prevEnabled) => prevEnabled && emailProtected);
setData((prevData) => ({
...prevData,
- denyList: emailAuthenticated && enabled ? newDenyList : [],
+ denyList: emailProtected && enabled ? newDenyList : [],
}));
- }, [denyListInput, enabled, emailAuthenticated, setData]);
+ }, [denyListInput, enabled, emailProtected, setData]);
const handleEnableDenyList = () => {
const updatedEnabled = !enabled;
diff --git a/components/links/link-sheet/email-authentication-section.tsx b/components/links/link-sheet/email-authentication-section.tsx
index 8c07061b..df88dd4f 100644
--- a/components/links/link-sheet/email-authentication-section.tsx
+++ b/components/links/link-sheet/email-authentication-section.tsx
@@ -32,8 +32,6 @@ export default function EmailAuthenticationSection({
...data,
emailProtected: updatedEmailAuthentication ? true : emailProtected,
emailAuthenticated: updatedEmailAuthentication,
- allowList: updatedEmailAuthentication ? data.allowList : [],
- denyList: updatedEmailAuthentication ? data.denyList : [],
});
setEnabled(updatedEmailAuthentication);
};
diff --git a/components/links/link-sheet/email-protection-section.tsx b/components/links/link-sheet/email-protection-section.tsx
index 6e11bc1d..9c3faa7e 100644
--- a/components/links/link-sheet/email-protection-section.tsx
+++ b/components/links/link-sheet/email-protection-section.tsx
@@ -24,6 +24,8 @@ export default function EmailProtectionSection({
emailProtected: updatedEmailProtection,
emailAuthenticated: !updatedEmailProtection && false,
enableAgreement: !updatedEmailProtection && false,
+ allowList: updatedEmailProtection ? data.allowList : [],
+ denyList: updatedEmailProtection ? data.denyList : [],
});
setEnabled(updatedEmailProtection);
};