Trees can now be freely re-arranged :D

This commit is contained in:
Stefan Zermatten
2019-07-31 11:52:11 +02:00
parent d0304da4fd
commit 4f93ad3e9b
9 changed files with 77 additions and 26 deletions

View File

@@ -45,7 +45,11 @@ export function assertEditPermission(doc, userId) {
function getRoot(doc){
assertdocExists(doc);
return fetchDocByRef(doc.ancestors && doc.ancestors.length && doc.ancestors[0] || doc);
if (doc.ancestors && doc.ancestors.length && doc.ancestors[0]){
return fetchDocByRef(doc.ancestors[0]);
} else {
return doc;
}
}
/**