Skip to content

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

added enableNotification option in link preset

Ashish Viradiyacbd77a390eff
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index f25c8b0e..f3449d28 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -248,7 +248,10 @@ export default function LinkSheet({
enableAgreement: preset.enableAgreement || prev.enableAgreement,
agreementId: preset.agreementId || prev.agreementId,
enableScreenshotProtection:
- preset.enableScreenshotProtection || prev.enableScreenshotProtection,
+ preset.enableScreenshotProtection ||
+ prev.enableScreenshotProtection,
+ enableNotification:
+ !!preset.enableNotification,
};
});
diff --git a/lib/zod/schemas/presets.ts b/lib/zod/schemas/presets.ts
index d94dd680..8da7e07f 100644
--- a/lib/zod/schemas/presets.ts
+++ b/lib/zod/schemas/presets.ts
@@ -50,6 +50,7 @@ export const presetDataSchema = z.object({
emailAuthenticated: z.boolean().optional(),
// Additional Options
+ enableNotification: z.boolean(),
allowDownload: z.boolean().optional(),
enablePassword: z.boolean(),
password: z.string().nullable(),
diff --git a/pages/settings/presets/[id].tsx b/pages/settings/presets/[id].tsx
index 0a160133..a6a7e97d 100644
--- a/pages/settings/presets/[id].tsx
+++ b/pages/settings/presets/[id].tsx
@@ -20,6 +20,7 @@ import { DEFAULT_LINK_TYPE } from "@/components/links/link-sheet";
import AgreementSection from "@/components/links/link-sheet/agreement-section";
import AllowDownloadSection from "@/components/links/link-sheet/allow-download-section";
import AllowListSection from "@/components/links/link-sheet/allow-list-section";
+import AllowNotificationSection from "@/components/links/link-sheet/allow-notification-section";
import { CustomFieldData } from "@/components/links/link-sheet/custom-fields-panel";
import CustomFieldsSection from "@/components/links/link-sheet/custom-fields-section";
import DenyListSection from "@/components/links/link-sheet/deny-list-section";
@@ -76,7 +77,6 @@ export default function EditPreset() {
const [showDeleteAlert, setShowDeleteAlert] = useState(false);
const {
- isStarter,
isPro,
isBusiness,
isDatarooms,
@@ -139,6 +139,7 @@ export default function EditPreset() {
agreementId: preset.agreementId,
enableCustomFields: customFields.length > 0,
customFields: customFields,
+ enableNotification: preset.enableNotification ?? true,
});
}
}, [preset]);
@@ -185,6 +186,7 @@ export default function EditPreset() {
enableScreenshotProtection: data.enableScreenshotProtection,
enableCustomFields: data.enableCustomFields,
customFields: data.customFields,
+ enableNotification: data.enableNotification,
}),
});
@@ -378,6 +380,11 @@ export default function EditPreset() {
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
+
+ <AllowNotificationSection
+ data={data as any}
+ setData={setData as any}
+ />
<AllowDownloadSection
data={data as any}
diff --git a/pages/settings/presets/new.tsx b/pages/settings/presets/new.tsx
index f3b30352..d214155c 100644
--- a/pages/settings/presets/new.tsx
+++ b/pages/settings/presets/new.tsx
@@ -1,5 +1,7 @@
import { useRouter } from "next/router";
+
+
import { FormEvent, useState } from "react";
import { useTeam } from "@/context/team-context";
@@ -20,6 +22,7 @@ import {
import AgreementSection from "@/components/links/link-sheet/agreement-section";
import AllowDownloadSection from "@/components/links/link-sheet/allow-download-section";
import AllowListSection from "@/components/links/link-sheet/allow-list-section";
+import AllowNotificationSection from "@/components/links/link-sheet/allow-notification-section";
import { CustomFieldData } from "@/components/links/link-sheet/custom-fields-panel";
import CustomFieldsSection from "@/components/links/link-sheet/custom-fields-section";
import DenyListSection from "@/components/links/link-sheet/deny-list-section";
@@ -55,7 +58,6 @@ export default function NewPreset() {
});
const {
- isStarter,
isPro,
isBusiness,
isDatarooms,
@@ -131,6 +133,7 @@ export default function NewPreset() {
? data.customFields.length > 0
: false,
customFields: data.customFields,
+ enableNotification: data.enableNotification,
}),
});
@@ -223,8 +226,8 @@ export default function NewPreset() {
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
+ <AllowNotificationSection data={data} setData={setData} />
<AllowDownloadSection data={data} setData={setData} />
-
<ExpirationInSection data={data} setData={setData} />
</div>
diff --git a/prisma/migrations/20250508113621_added_enable_notification_linkpreset/migration.sql b/prisma/migrations/20250508113621_added_enable_notification_linkpreset/migration.sql
new file mode 100644
index 00000000..fd8dcb48
--- /dev/null
+++ b/prisma/migrations/20250508113621_added_enable_notification_linkpreset/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "LinkPreset" ADD COLUMN "enableNotification" BOOLEAN DEFAULT true;
diff --git a/prisma/schema/link.prisma b/prisma/schema/link.prisma
index 95b11c72..3808a871 100644
--- a/prisma/schema/link.prisma
+++ b/prisma/schema/link.prisma
@@ -93,6 +93,7 @@ model LinkPreset {
metaImage String? // This will be the meta image of the link
metaFavicon String? // This will be the meta favicon of the link
+ enableNotification Boolean? @default(true)
emailProtected Boolean? @default(true)
emailAuthenticated Boolean? @default(false)
allowDownload Boolean? @default(false)