Stopped root page from exporting as html and fix URL for icon

This commit is contained in:
2020-02-09 05:55:07 -06:00
parent 3f9730955a
commit c780aa5fba
2 changed files with 5 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ class Export extends Controller {
const pages = await Page.find({ OrgUserId: user._id })
const ExportData = {}
for (const page of pages) {
for (const page of pages) { //for all pages of the user, generate a copy of the data
const nodes = await Node.find({ PageId: page.UUID })
const PageData = { ...page }
@@ -84,7 +84,7 @@ class Export extends Controller {
const Page = this.models.get('api:Page')
const Node = this.models.get('api:Node')
const user = req.user
const pages = await Page.find({ OrgUserId: user._id })
const pages = await Page.find({ OrgUserId: user._id, ParentId: { $ne: '0' } })
const mapping = {} //keeps track of html file UUID and file name
const page0 = await user.get_root_page() //topmost page
@@ -121,12 +121,12 @@ class Export extends Controller {
const Node = this.models.get('api:Node')
const virt_root = await user.get_root_page()
return await this._sidebar_recurse(mapping, virt_root)
}
async _sidebar_recurse(mapping, parent) {
const Page = this.models.get('api:Page')
const Node = this.models.get('api:Node')
const children = await Page.find({ ParentId : parent.UUID})
const children = await Page.find({ ParentId: parent.UUID })
let base = ''
for (const child of children) {
if (child.ChildPageIds.length === 0) {