Resilient to collection or document not existing

This commit is contained in:
Tom Moor committed 2017-07-23 15:26:00 -07:00
1 parent 2ac115d681
commit e6938ee06f
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -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,
});
+1 -1
View File
@@ -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);
}