hoisting notes WIP

This commit is contained in:
azivner
2018-12-11 21:53:56 +01:00
parent 8171b68b18
commit 6fbf28b30d
8 changed files with 67 additions and 6 deletions

View File

@@ -4,13 +4,18 @@ import Branch from "../entities/branch.js";
import server from "./server.js";
import treeCache from "./tree_cache.js";
import messagingService from "./messaging.js";
import hoistedNoteService from "./hoisted_note.js";
async function prepareTree(noteRows, branchRows, relations) {
utils.assertArguments(noteRows, branchRows, relations);
treeCache.load(noteRows, branchRows, relations);
return [ await prepareNode(await treeCache.getBranch('root')) ];
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
const hoistedNote = await treeCache.getNote(hoistedNoteId);
const hoistedBranch = (await hoistedNote.getBranches())[0];
return [ await prepareNode(hoistedBranch) ];
}
async function prepareBranch(note) {