From 1375946bc5c2a55dcef96ee37ea432bfce631552 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Thu, 21 Mar 2024 22:02:09 +0800 Subject: [PATCH] chore: refactor --- apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx | 2 +- packages/lib/server-only/document/is-recipient-authorized.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx b/apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx index a0342b935..92209bcc7 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx @@ -136,7 +136,7 @@ export const EditDocumentForm = ({ toast({ title: 'Error', - description: 'An error occurred while updating the general settings.', + description: 'An error occurred while updating the document settings.', variant: 'destructive', }); } diff --git a/packages/lib/server-only/document/is-recipient-authorized.ts b/packages/lib/server-only/document/is-recipient-authorized.ts index bf595fa9b..2c7e9b6e4 100644 --- a/packages/lib/server-only/document/is-recipient-authorized.ts +++ b/packages/lib/server-only/document/is-recipient-authorized.ts @@ -26,7 +26,7 @@ type IsRecipientAuthorizedOptions = { authOptions?: TDocumentAuthMethods; }; -const getRecipient = async (email: string) => { +const getUserByEmail = async (email: string) => { return await prisma.user.findFirst({ where: { email, @@ -74,7 +74,7 @@ export const isRecipientAuthorized = async ({ return false; } - const recipientUser = await getRecipient(recipient.email); + const recipientUser = await getUserByEmail(recipient.email); if (!recipientUser) { return false;