Skip to content

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

fix

Ashish Viradiyadd95932cef6e
diff --git a/components/view/dataroom/dataroom-document-view.tsx b/components/view/dataroom/dataroom-document-view.tsx
index 16a21b00..b8447149 100644
--- a/components/view/dataroom/dataroom-document-view.tsx
+++ b/components/view/dataroom/dataroom-document-view.tsx
@@ -333,6 +333,7 @@ export default function DataroomDocumentView({
userEmail ??
undefined
}
+ canDownload={viewData.canDownload}
/>
) : (
<div className="flex h-screen items-center justify-center">
diff --git a/components/view/view-data.tsx b/components/view/view-data.tsx
index 7f51feeb..597b293c 100644
--- a/components/view/view-data.tsx
+++ b/components/view/view-data.tsx
@@ -38,6 +38,14 @@ export type TViewDocumentData = Document & {
versions: DocumentVersion[];
};
+const isDownloadAllowed = (
+ canDownload: boolean | undefined,
+ linkAllowDownload: boolean | undefined,
+): boolean => {
+ if (canDownload === false) return false;
+ return !!linkAllowDownload;
+};
+
export default function ViewData({
viewData,
link,
@@ -49,6 +57,7 @@ export default function ViewData({
useAdvancedExcelViewer,
viewerEmail,
dataroomId,
+ canDownload,
}: {
viewData: DEFAULT_DOCUMENT_VIEW_TYPE | DEFAULT_DATAROOM_DOCUMENT_VIEW_TYPE;
link: LinkWithDocument | LinkWithDataroomDocument;
@@ -64,6 +73,7 @@ export default function ViewData({
useAdvancedExcelViewer?: boolean;
viewerEmail?: string;
dataroomId?: string;
+ canDownload?: boolean;
}) {
const { isMobile } = useMediaQuery();
@@ -83,9 +93,11 @@ export default function ViewData({
? viewData.conversationsEnabled
: false),
assistantEnabled: document.assistantEnabled,
- allowDownload: link.allowDownload ?? false,
+ allowDownload: isDownloadAllowed(canDownload, link.allowDownload ?? false),
};
+ // Calculate allowDownload once for all components
+
return notionData?.recordMap ? (
<NotionPage
recordMap={notionData.recordMap}
@@ -177,4 +189,4 @@ export default function ViewData({
navData={navData}
/>
);
-}
+}
\ No newline at end of file