From e1251222cc5e6143e8c828c75045788f38242b79 Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 6 Nov 2017 19:23:35 -0500 Subject: [PATCH] sync fix and more logging --- app.js | 5 +++-- routes/api/notes_move.js | 3 +-- services/source_id.js | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 5584ba3de..e4802b974 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,5 @@ +const log = require('./services/log'); +log.info("App starting up"); const express = require('express'); const path = require('path'); const favicon = require('serve-favicon'); @@ -8,13 +10,12 @@ const session = require('express-session'); const FileStore = require('session-file-store')(session); const os = require('os'); const options = require('./services/options'); -const log = require('./services/log'); const utils = require('./services/utils'); const sql = require('./services/sql'); - const dataDir = require('./services/data_dir'); const sessionSecret = require('./services/session_secret'); + const db = require('sqlite'); db.open(dataDir.DOCUMENT_PATH, { Promise }).then(async () => { diff --git a/routes/api/notes_move.js b/routes/api/notes_move.js index e9557e60a..75796b26d 100644 --- a/routes/api/notes_move.js +++ b/routes/api/notes_move.js @@ -87,8 +87,7 @@ router.put('/:noteId/expanded/:expanded', async (req, res, next) => { const now = utils.nowTimestamp(); await sql.doInTransaction(async () => { - // we don't change date_modified so other changes are prioritized in case of conflict - await sql.execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, noteId]); + await sql.execute("update notes_tree set is_expanded = ?, date_modified = ? where note_id = ?", [expanded, now, noteId]); await sql.addNoteTreeSync(noteId); await sql.addAudit(audit_category.CHANGE_EXPANDED, utils.browserId(req), noteId, null, expanded); diff --git a/services/source_id.js b/services/source_id.js index 9721d99fb..78efc684c 100644 --- a/services/source_id.js +++ b/services/source_id.js @@ -1,3 +1,8 @@ const utils = require('./utils'); +const log = require('./log'); -module.exports = utils.randomString(16); \ No newline at end of file +const sourceId = utils.randomString(16); + +log.info("Using sourceId=" + sourceId); + +module.exports = sourceId; \ No newline at end of file