Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion backend/src/routes/tabular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,22 @@ tabularRouter.post("/:reviewId/generate", requireAuth, async (req, res) => {
.select("id, current_version_id")
.eq("project_id", review.project_id)
.order("created_at", { ascending: true });
docs = data ?? [];
const projectDocs = (data ?? []) as Record<string, unknown>[];
const accessibleProjectDocIds = new Set(
await filterAccessibleDocumentIds(
projectDocs
.map((doc) => doc.id)
.filter((id): id is string => typeof id === "string"),
userId,
userEmail,
db,
),
);
docs = projectDocs.filter(
(doc) =>
typeof doc.id === "string" &&
accessibleProjectDocIds.has(doc.id),
);
}
await attachActiveVersionPaths(
db,
Expand Down