Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add document name & owner email to view request
Marc Seitze585ce570622
diff --git a/components/view/document-view.tsx b/components/view/document-view.tsxindex 6cb3e5c6..3a53c478 100644--- a/components/view/document-view.tsx+++ b/components/view/document-view.tsx@@ -72,6 +72,8 @@ export default function DocumentView({email: data.email || verifiedEmail || userEmail,linkId: link.id,documentId: document.id,+ documentName: document.name,+ ownerId: document.ownerId,userId: userId || null,documentVersionId: document.versions[0].id,hasPages: document.versions[0].hasPages,diff --git a/pages/api/links/[id]/index.ts b/pages/api/links/[id]/index.tsindex e5baaea4..20d0cec2 100644--- a/pages/api/links/[id]/index.ts+++ b/pages/api/links/[id]/index.ts@@ -35,8 +35,10 @@ export default async function handle(document: {select: {id: true,+ name: true,assistantEnabled: true,teamId: true,+ ownerId: true,versions: {where: { isPrimary: true },select: {diff --git a/pages/api/links/domains/[...domainSlug].ts b/pages/api/links/domains/[...domainSlug].tsindex ecab1d59..352ad176 100644--- a/pages/api/links/domains/[...domainSlug].ts+++ b/pages/api/links/domains/[...domainSlug].ts@@ -42,6 +42,8 @@ export default async function handle(document: {select: {id: true,+ name: true,+ ownerId: true,team: { select: { id: true, plan: true } },versions: {where: { isPrimary: true },@@ -61,7 +63,11 @@ export default async function handle(// if link not found, return 404if (!link || !link.document.team) {- log({message: `Link not found for custom domain _${domain}/${slug}_`, type: "error", mention: true})+ log({+ message: `Link not found for custom domain _${domain}/${slug}_`,+ type: "error",+ mention: true,+ });return res.status(404).json({error: "Link not found",message: `no link found, team ${link?.document.team}`,@@ -70,7 +76,11 @@ export default async function handle(// if owner of document is on free plan, return 404if (link.document.team.plan === "free") {- log({message: `Link is from a free team _${link.document.team.id}_ for custom domain _${domain}/${slug}_`, type: "info", mention: true})+ log({+ message: `Link is from a free team _${link.document.team.id}_ for custom domain _${domain}/${slug}_`,+ type: "info",+ mention: true,+ });return res.status(404).json({error: "Link not found",message: `link found, team ${link.document.team.plan}`,@@ -93,7 +103,11 @@ export default async function handle(res.status(200).json({ link, brand });} catch (error) {- log({message: `Cannot get link for custom domain _${domainSlug}_ \n\n${error}`, type: "error", mention: true})+ log({+ message: `Cannot get link for custom domain _${domainSlug}_ \n\n${error}`,+ type: "error",+ mention: true,+ });return res.status(500).json({message: "Internal Server Error",error: (error as Error).message,diff --git a/pages/api/views.ts b/pages/api/views.tsindex aee43620..c7748136 100644--- a/pages/api/views.ts+++ b/pages/api/views.ts@@ -22,8 +22,10 @@ export default async function handle(documentId,userId,documentVersionId,+ documentName,hasPages,token,+ ownerId,verifiedEmail,...data} = req.body as {@@ -31,8 +33,10 @@ export default async function handle(documentId: string;userId: string | null;documentVersionId: string;+ documentName: string;hasPages: boolean;token: string | null;+ ownerId: string;verifiedEmail: string | null;};