fix: mask recipient tokens for non-owners

This commit is contained in:
Lucas Smith
2024-01-20 01:14:34 +00:00
parent 204388888d
commit 9c1e1f50a8
5 changed files with 68 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import { SigningStatus } from '@documenso/prisma/client';
import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-document-status';
import type { FindResultSet } from '../../types/find-result-set';
import { maskRecipientTokensForDocument } from '../../utils/mask-recipient-tokens-for-document';
export type FindDocumentsOptions = {
userId: number;
@@ -173,8 +174,15 @@ export const findDocuments = async ({
}),
]);
const maskedData = data.map((document) =>
maskRecipientTokensForDocument({
document,
user,
}),
);
return {
data,
data: maskedData,
count,
currentPage: Math.max(page, 1),
perPage,