fix: JS error on server
This commit is contained in:
@ -887,9 +887,9 @@ router.post('documents.move', auth(), async ctx => {
|
|||||||
|
|
||||||
const user = ctx.state.user;
|
const user = ctx.state.user;
|
||||||
const document = await Document.findByPk(id, { userId: user.id });
|
const document = await Document.findByPk(id, { userId: user.id });
|
||||||
const { collection } = document;
|
|
||||||
authorize(user, 'move', document);
|
authorize(user, 'move', document);
|
||||||
|
|
||||||
|
const { collection } = document;
|
||||||
if (collection.type !== 'atlas' && parentDocumentId) {
|
if (collection.type !== 'atlas' && parentDocumentId) {
|
||||||
throw new InvalidRequestError(
|
throw new InvalidRequestError(
|
||||||
'Document cannot be nested in this collection type'
|
'Document cannot be nested in this collection type'
|
||||||
|
Reference in New Issue
Block a user