Skip to content

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

refactor: emailProtected doesn't need to be an optional value with a default value

Marc Seitzf0e467e27270
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index 1b91cdd0..d93e68f7 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -29,7 +29,7 @@ export type DEFAULT_LINK_TYPE = {
name: string | null;
expiresAt: Date | null;
password: string | null;
- emailProtected: boolean | true;
+ emailProtected: boolean;
};
diff --git a/components/links/links-table.tsx b/components/links/links-table.tsx
index 58188c87..a5f633e0 100644
--- a/components/links/links-table.tsx
+++ b/components/links/links-table.tsx
@@ -53,7 +53,7 @@ export default function LinksTable() {
name: link.name,
expiresAt: link.expiresAt,
password: link.password,
- emailProtected: link.emailProtected || true,
+ emailProtected: link.emailProtected,
});
setIsLinkSheetVisible(true);
};
diff --git a/pages/api/links/[id]/index.ts b/pages/api/links/[id]/index.ts
index 78f519a2..0dda4e59 100644
--- a/pages/api/links/[id]/index.ts
+++ b/pages/api/links/[id]/index.ts
@@ -53,7 +53,7 @@ export default async function handle(
documentId: documentId,
password: hashedPassword,
name: linkData.name || null,
- emailProtected: linkData.emailProtected || false,
+ emailProtected: linkData.emailProtected,
expiresAt: exat,
},
include: {
diff --git a/pages/api/links/index.ts b/pages/api/links/index.ts
index ba37d67d..2c8eb9e0 100644
--- a/pages/api/links/index.ts
+++ b/pages/api/links/index.ts
@@ -25,7 +25,7 @@ export default async function handler(
documentId: documentId,
password: hashedPassword,
name: linkData.name || null,
- emailProtected: linkData.emailProtected || false,
+ emailProtected: linkData.emailProtected,
expiresAt: exat
},
});
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 8d1b67dc..039a8c4a 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -81,7 +81,7 @@ model Link {
expiresAt DateTime? // Optional expiration date
password String? // Optional password for link protection
allowedEmails String[] // Array of emails allowed to view the document
- emailProtected Boolean? @default(true) // Optional email protection
+ emailProtected Boolean @default(true) // Optional email protection
isArchived Boolean @default(false) // Indicates if the link is archived
views View[]
createdAt DateTime @default(now())