diff --git a/server/api/documents.js b/server/api/documents.js index 5205e2c5..f5192660 100644 --- a/server/api/documents.js +++ b/server/api/documents.js @@ -40,7 +40,7 @@ router.post('documents.viewed', auth(), pagination(), async ctx => { const views = await View.findAll({ where: { userId: user.id }, order: [[sort, direction]], - include: [{ model: Document }], + include: [{ model: Document, required: true }], offset: ctx.state.pagination.offset, limit: ctx.state.pagination.limit, }); diff --git a/server/presenters/document.js b/server/presenters/document.js index 0cf8db4c..f26df3fc 100644 --- a/server/presenters/document.js +++ b/server/presenters/document.js @@ -36,7 +36,7 @@ async function present(ctx: Object, document: Document, options: ?Options) { views: undefined, }; - if (document.private) { + if (document.private && document.collection) { data.collection = await presentCollection(ctx, document.collection); }