fix: Error when accessing search from share logged in, 0067d1a58d
This commit is contained in:
@@ -799,6 +799,7 @@ router.post(
|
|||||||
let teamId;
|
let teamId;
|
||||||
let response;
|
let response;
|
||||||
let share;
|
let share;
|
||||||
|
let isPublic = false;
|
||||||
|
|
||||||
if (shareId) {
|
if (shareId) {
|
||||||
const teamFromCtx = await getTeamFromContext(ctx);
|
const teamFromCtx = await getTeamFromContext(ctx);
|
||||||
@@ -809,6 +810,7 @@ router.post(
|
|||||||
});
|
});
|
||||||
|
|
||||||
share = loaded.share;
|
share = loaded.share;
|
||||||
|
isPublic = cannot(user, "read", document);
|
||||||
|
|
||||||
if (!share?.includeChildDocuments) {
|
if (!share?.includeChildDocuments) {
|
||||||
throw InvalidRequestError("Child documents cannot be searched");
|
throw InvalidRequestError("Child documents cannot be searched");
|
||||||
@@ -878,7 +880,6 @@ router.post(
|
|||||||
|
|
||||||
const data = await Promise.all(
|
const data = await Promise.all(
|
||||||
results.map(async (result) => {
|
results.map(async (result) => {
|
||||||
const isPublic = cannot(user, "read", result.document);
|
|
||||||
const document = await presentDocument(ctx, result.document, {
|
const document = await presentDocument(ctx, result.document, {
|
||||||
isPublic,
|
isPublic,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user