Skip to content

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

feat: toggle dependency link settings for conversations

Marc Seitze2cadd7ce842
diff --git a/components/links/link-sheet/email-authentication-section.tsx b/components/links/link-sheet/email-authentication-section.tsx
index cf58a751..568e7280 100644
--- a/components/links/link-sheet/email-authentication-section.tsx
+++ b/components/links/link-sheet/email-authentication-section.tsx
@@ -19,7 +19,7 @@ export default function EmailAuthenticationSection({
plan,
}: LinkUpgradeOptions) => void;
}) {
- const { emailProtected, emailAuthenticated } = data;
+ const { emailProtected, emailAuthenticated, enableConversation } = data;
const [enabled, setEnabled] = useState<boolean>(emailAuthenticated);
useEffect(() => {
@@ -32,6 +32,9 @@ export default function EmailAuthenticationSection({
...data,
emailProtected: updatedEmailAuthentication ? true : emailProtected,
emailAuthenticated: updatedEmailAuthentication,
+ enableConversation: updatedEmailAuthentication
+ ? enableConversation
+ : false,
});
setEnabled(updatedEmailAuthentication);
};
diff --git a/components/links/link-sheet/email-protection-section.tsx b/components/links/link-sheet/email-protection-section.tsx
index 969aa57a..8cace2eb 100644
--- a/components/links/link-sheet/email-protection-section.tsx
+++ b/components/links/link-sheet/email-protection-section.tsx
@@ -23,6 +23,7 @@ export default function EmailProtectionSection({
...data,
emailProtected: updatedEmailProtection,
emailAuthenticated: !updatedEmailProtection && false,
+ enableConversation: !updatedEmailProtection && false,
enableAgreement: !updatedEmailProtection && false,
allowList: updatedEmailProtection ? data.allowList : [],
denyList: updatedEmailProtection ? data.denyList : [],
diff --git a/ee/features/conversations/components/link-option-conversation-section.tsx b/ee/features/conversations/components/link-option-conversation-section.tsx
index b657478c..075b07b4 100644
--- a/ee/features/conversations/components/link-option-conversation-section.tsx
+++ b/ee/features/conversations/components/link-option-conversation-section.tsx
@@ -28,10 +28,21 @@ export default function ConversationSection({
const handleEnableConversation = () => {
const updatedEnableConversation = !enabled;
- setData({
- ...data,
- enableConversation: updatedEnableConversation,
- });
+ if (updatedEnableConversation) {
+ // Only set email settings to true when enabling conversations
+ setData({
+ ...data,
+ enableConversation: true,
+ emailAuthenticated: true,
+ emailProtected: true,
+ });
+ } else {
+ // When disabling conversations, don't modify email settings
+ setData({
+ ...data,
+ enableConversation: false,
+ });
+ }
setEnabled(updatedEnableConversation);
};