renamed start_note_tree_id option to startNotePath

This commit is contained in:
azivner 2017-12-06 23:15:53 -05:00
parent f1256423ac
commit 6fad30e9af
6 changed files with 11 additions and 10 deletions

View File

@ -0,0 +1 @@
UPDATE options SET opt_name = 'start_note_path' WHERE opt_name = 'start_note_tree_id';

View File

@ -4,7 +4,7 @@ const noteTree = (function() {
const treeEl = $("#tree"); const treeEl = $("#tree");
const parentListEl = $("#parent-list"); const parentListEl = $("#parent-list");
let startNoteTreeId = null; let startNotePath = null;
let notesTreeMap = {}; let notesTreeMap = {};
let parentToChildren = {}; let parentToChildren = {};
@ -412,8 +412,8 @@ const noteTree = (function() {
setExpandedToServer(data.node.data.note_tree_id, false); setExpandedToServer(data.node.data.note_tree_id, false);
}, },
init: (event, data) => { init: (event, data) => {
if (startNoteTreeId) { if (startNotePath) {
activateNode(startNoteTreeId); activateNode(startNotePath);
} }
else { else {
showAppIfHidden(); showAppIfHidden();
@ -503,10 +503,10 @@ const noteTree = (function() {
function loadTree() { function loadTree() {
return server.get('tree').then(resp => { return server.get('tree').then(resp => {
startNoteTreeId = resp.start_note_tree_id; startNotePath = resp.start_note_path;
if (document.location.hash) { if (document.location.hash) {
startNoteTreeId = document.location.hash.substr(1); // strip initial # startNotePath = document.location.hash.substr(1); // strip initial #
} }
return prepareNoteTree(resp.notes, resp.notes_parent); return prepareNoteTree(resp.notes, resp.notes_parent);

View File

@ -26,7 +26,7 @@ router.put('/:noteTreeId/:notePath', auth.checkApiAuth, async (req, res, next) =
await sync_table.addRecentNoteSync(noteTreeId); await sync_table.addRecentNoteSync(noteTreeId);
await options.setOption('start_note_tree_id', notePath); await options.setOption('start_note_path', notePath);
}); });
res.send(await getRecentNotes()); res.send(await getRecentNotes());

View File

@ -31,7 +31,7 @@ router.get('/', auth.checkApiAuth, async (req, res, next) => {
res.send({ res.send({
notes: notes, notes: notes,
start_note_tree_id: await options.getOption('start_note_tree_id') start_note_path: await options.getOption('start_note_path')
}); });
}); });

View File

@ -3,7 +3,7 @@
const build = require('./build'); const build = require('./build');
const packageJson = require('../package'); const packageJson = require('../package');
const APP_DB_VERSION = 48; const APP_DB_VERSION = 49;
module.exports = { module.exports = {
app_version: packageJson.version, app_version: packageJson.version,

View File

@ -28,7 +28,7 @@ async function setOption(optName, optValue) {
}); });
} }
async function initOptions(startNoteTreeId) { async function initOptions(startNotePath) {
await setOption('document_id', utils.randomSecureToken(16)); await setOption('document_id', utils.randomSecureToken(16));
await setOption('document_secret', utils.randomSecureToken(16)); await setOption('document_secret', utils.randomSecureToken(16));
@ -39,7 +39,7 @@ async function initOptions(startNoteTreeId) {
await setOption('encrypted_data_key', ''); await setOption('encrypted_data_key', '');
await setOption('encrypted_data_key_iv', ''); await setOption('encrypted_data_key_iv', '');
await setOption('start_note_tree_id', startNoteTreeId); await setOption('start_note_path', startNotePath);
await setOption('protected_session_timeout', 600); await setOption('protected_session_timeout', 600);
await setOption('history_snapshot_time_interval', 600); await setOption('history_snapshot_time_interval', 600);
await setOption('last_backup_date', utils.nowTimestamp()); await setOption('last_backup_date', utils.nowTimestamp());