Skip to content

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

feat: show archived links on documents

Marc Seitz1bb44a064c53
diff --git a/components/links/links-table.tsx b/components/links/links-table.tsx
index 3db05d2b..6bb3f252 100644
--- a/components/links/links-table.tsx
+++ b/components/links/links-table.tsx
@@ -17,13 +17,13 @@ import {
} from "lucide-react";
import { useQueryState } from "nuqs";
import { toast } from "sonner";
-import useSWR, { mutate } from "swr";
+import { mutate } from "swr";
import z from "zod";
import { usePlan } from "@/lib/swr/use-billing";
import useLimits from "@/lib/swr/use-limits";
import { LinkWithViews, WatermarkConfig } from "@/lib/types";
-import { cn, copyToClipboard, fetcher, nFormatter, timeAgo } from "@/lib/utils";
+import { cn, copyToClipboard, nFormatter, timeAgo } from "@/lib/utils";
import { useMediaQuery } from "@/lib/utils/use-media-query";
import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
diff --git a/pages/api/analytics/index.ts b/pages/api/analytics/index.ts
index 61fddc11..e918a6b0 100644
--- a/pages/api/analytics/index.ts
+++ b/pages/api/analytics/index.ts
@@ -237,7 +237,6 @@ export default async function handler(
const links = await prisma.link.findMany({
where: {
teamId,
- isArchived: false,
views: {
some: {
viewedAt: intervalFilter,
diff --git a/pages/api/teams/[teamId]/documents/[id]/links.ts b/pages/api/teams/[teamId]/documents/[id]/links.ts
index 1f6b72f7..c13d0689 100644
--- a/pages/api/teams/[teamId]/documents/[id]/links.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/links.ts
@@ -1,5 +1,6 @@
import { NextApiRequest, NextApiResponse } from "next";
+import { authOptions } from "@/pages/api/auth/[...nextauth]";
import { getServerSession } from "next-auth/next";
import { errorhandler } from "@/lib/errorHandler";
@@ -7,8 +8,6 @@ import prisma from "@/lib/prisma";
import { CustomUser } from "@/lib/types";
import { decryptEncrpytedPassword, log } from "@/lib/utils";
-import { authOptions } from "../../../../auth/[...nextauth]";
-
export default async function handle(
req: NextApiRequest,
res: NextApiResponse,
@@ -43,7 +42,7 @@ export default async function handle(
ownerId: true,
_count: {
select: {
- links: { where: { isArchived: false } },
+ links: true,
},
},
},
@@ -65,7 +64,6 @@ export default async function handle(
id: true,
ownerId: true,
links: {
- where: { isArchived: false },
orderBy: { createdAt: "desc" },
include: {
views: { orderBy: { viewedAt: "desc" } },