fix: Sidebar missing on public documents when accessing with valid team token

This commit is contained in:
Tom Moor
2022-05-22 08:51:47 +01:00
parent bc7052b7ca
commit 6d7f008af0

View File

@@ -467,10 +467,16 @@ async function loadDocument({
await share.update({
lastAccessedAt: new Date(),
});
// Cannot use document.collection here as it does not include the
// documentStructure by default through the relationship.
collection = await Collection.findByPk(document.collectionId);
invariant(collection, "collection not found");
return {
document,
share,
collection: document.collection,
collection,
};
}