diff --git a/migrations/0049__rename_start_note_tree_id_to_note_path.sql b/migrations/0049__rename_start_note_tree_id_to_note_path.sql new file mode 100644 index 000000000..0ba12b4e9 --- /dev/null +++ b/migrations/0049__rename_start_note_tree_id_to_note_path.sql @@ -0,0 +1 @@ +UPDATE options SET opt_name = 'start_note_path' WHERE opt_name = 'start_note_tree_id'; \ No newline at end of file diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index 68c020a49..08ecc7987 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -4,7 +4,7 @@ const noteTree = (function() { const treeEl = $("#tree"); const parentListEl = $("#parent-list"); - let startNoteTreeId = null; + let startNotePath = null; let notesTreeMap = {}; let parentToChildren = {}; @@ -412,8 +412,8 @@ const noteTree = (function() { setExpandedToServer(data.node.data.note_tree_id, false); }, init: (event, data) => { - if (startNoteTreeId) { - activateNode(startNoteTreeId); + if (startNotePath) { + activateNode(startNotePath); } else { showAppIfHidden(); @@ -503,10 +503,10 @@ const noteTree = (function() { function loadTree() { return server.get('tree').then(resp => { - startNoteTreeId = resp.start_note_tree_id; + startNotePath = resp.start_note_path; 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); diff --git a/routes/api/recent_notes.js b/routes/api/recent_notes.js index 1b78c8151..eda3cbac7 100644 --- a/routes/api/recent_notes.js +++ b/routes/api/recent_notes.js @@ -26,7 +26,7 @@ router.put('/:noteTreeId/:notePath', auth.checkApiAuth, async (req, res, next) = await sync_table.addRecentNoteSync(noteTreeId); - await options.setOption('start_note_tree_id', notePath); + await options.setOption('start_note_path', notePath); }); res.send(await getRecentNotes()); diff --git a/routes/api/tree.js b/routes/api/tree.js index 50186750d..6cdab2ee9 100644 --- a/routes/api/tree.js +++ b/routes/api/tree.js @@ -31,7 +31,7 @@ router.get('/', auth.checkApiAuth, async (req, res, next) => { res.send({ notes: notes, - start_note_tree_id: await options.getOption('start_note_tree_id') + start_note_path: await options.getOption('start_note_path') }); }); diff --git a/services/app_info.js b/services/app_info.js index 4dba8a793..88194af3c 100644 --- a/services/app_info.js +++ b/services/app_info.js @@ -3,7 +3,7 @@ const build = require('./build'); const packageJson = require('../package'); -const APP_DB_VERSION = 48; +const APP_DB_VERSION = 49; module.exports = { app_version: packageJson.version, diff --git a/services/options.js b/services/options.js index bac7f6da8..129a9e991 100644 --- a/services/options.js +++ b/services/options.js @@ -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_secret', utils.randomSecureToken(16)); @@ -39,7 +39,7 @@ async function initOptions(startNoteTreeId) { await setOption('encrypted_data_key', ''); 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('history_snapshot_time_interval', 600); await setOption('last_backup_date', utils.nowTimestamp());