feat: browse nav + pageTree ancestors

This commit is contained in:
NGPixel
2020-04-12 18:05:48 -04:00
committed by Nicolas Giard
parent 3ca72ccc1e
commit 1c80faa94d
11 changed files with 210 additions and 62 deletions

View File

@@ -19,6 +19,7 @@ module.exports = async (pageId) => {
let currentPath = ''
let depth = 0
let parentId = null
let ancestors = []
for (const part of pagePaths) {
depth++
const isFolder = (depth < pagePaths.length)
@@ -39,7 +40,8 @@ module.exports = async (pageId) => {
isPrivate: !isFolder && page.isPrivate,
privateNS: !isFolder ? page.privateNS : null,
parent: parentId,
pageId: isFolder ? null : page.id
pageId: isFolder ? null : page.id,
ancestors: JSON.stringify(ancestors)
})
parentId = pik
} else if (isFolder && !found.isFolder) {
@@ -48,6 +50,7 @@ module.exports = async (pageId) => {
} else {
parentId = found.id
}
ancestors.push(parentId)
}
}