From 56762e98ebde91e3155b3254052444609a970db6 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Mon, 9 Dec 2024 17:11:18 +0700 Subject: [PATCH] refactor: streamline collaborator check in Document schema - Simplified the collaborator check logic in the DocumentSchema by condensing the condition into a single line for improved readability. - Maintained existing functionality while enhancing code clarity and maintainability. --- src/Document/document.schema.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Document/document.schema.ts b/src/Document/document.schema.ts index f7eae09..6c354ba 100644 --- a/src/Document/document.schema.ts +++ b/src/Document/document.schema.ts @@ -461,10 +461,7 @@ export class DocumentSchema extends PothosSchema { if (!document.isPublic) { if ( document.ownerId !== ctx.websocket?.me?.id && - !document.collaborators.some((c) => - c.userId === ctx.websocket?.me?.id && - (c.writable || c.readable) - ) + !document.collaborators.some((c) => c.userId === ctx.websocket?.me?.id && (c.writable || c.readable)) ) { throw new Error('User is not owner or collaborator of document') }