Skip to content

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

feat: only send notifications to active members

Marc Seitz2e4f393d1f29
diff --git a/pages/api/jobs/send-notification.ts b/pages/api/jobs/send-notification.ts
index 10127b13..30e7a9dc 100644
--- a/pages/api/jobs/send-notification.ts
+++ b/pages/api/jobs/send-notification.ts
@@ -117,10 +117,11 @@ export default async function handle(
? view.document!.teamId!
: view.dataroom!.teamId!;
- // Get all team members who are admins or managers to be notified
+ // Get all active team members who are admins or managers to be notified
const users = await prisma.userTeam.findMany({
where: {
role: { in: ["ADMIN", "MANAGER"] },
+ status: "ACTIVE",
teamId: teamId,
},
select: {
@@ -133,7 +134,7 @@ export default async function handle(
},
});
- // Get the owner of the document
+ // Get the active owner of the document
let ownerEmail: string | null = null;
if (view.document?.ownerId) {
const ownerUser = await prisma.userTeam.findUnique({
@@ -142,6 +143,7 @@ export default async function handle(
userId: view.document!.ownerId!,
teamId: teamId,
},
+ status: "ACTIVE",
},
select: {
user: {