fix: Error when accessing search from share logged in, 0067d1a58d

This commit is contained in:
Tom Moor
2024-07-06 11:49:51 -04:00
parent 1efd3b6f96
commit c484d1defe

View File

@@ -799,6 +799,7 @@ router.post(
let teamId;
let response;
let share;
let isPublic = false;
if (shareId) {
const teamFromCtx = await getTeamFromContext(ctx);
@@ -809,6 +810,7 @@ router.post(
});
share = loaded.share;
isPublic = cannot(user, "read", document);
if (!share?.includeChildDocuments) {
throw InvalidRequestError("Child documents cannot be searched");
@@ -878,7 +880,6 @@ router.post(
const data = await Promise.all(
results.map(async (result) => {
const isPublic = cannot(user, "read", result.document);
const document = await presentDocument(ctx, result.document, {
isPublic,
});