feat: sharing drafts (#991)

closes #988
This commit is contained in:
Tom Moor
2019-07-13 12:40:25 -07:00
committed by GitHub
parent 18d104218e
commit be09ffea7b
3 changed files with 42 additions and 4 deletions

View File

@ -17,6 +17,7 @@ import {
View,
Revision,
Backlink,
User,
} from '../models';
import { InvalidRequestError } from '../errors';
import events from '../events';
@ -286,7 +287,12 @@ router.post('documents.info', auth({ required: false }), async ctx => {
},
include: [
{
model: Document,
// unscoping here allows us to return unpublished documents
model: Document.unscoped(),
include: [
{ model: User, as: 'createdBy', paranoid: false },
{ model: User, as: 'updatedBy', paranoid: false },
],
required: true,
as: 'document',
},