per-browser source id so we support having notecase opened in multiple tabs/windows

This commit is contained in:
azivner
2017-12-16 20:48:34 -05:00
parent 03d86209ca
commit 50ff5da947
17 changed files with 98 additions and 83 deletions

View File

@@ -15,6 +15,7 @@ router.get('', auth.checkApiAuth, async (req, res, next) => {
router.put('/:noteTreeId/:notePath', auth.checkApiAuth, async (req, res, next) => {
const noteTreeId = req.params.noteTreeId;
const notePath = req.params.notePath;
const sourceId = req.headers.source_id;
await sql.doInTransaction(async () => {
await sql.replace('recent_notes', {
@@ -24,9 +25,9 @@ router.put('/:noteTreeId/:notePath', auth.checkApiAuth, async (req, res, next) =
is_deleted: 0
});
await sync_table.addRecentNoteSync(noteTreeId);
await sync_table.addRecentNoteSync(noteTreeId, sourceId);
await options.setOption('start_note_path', notePath);
await options.setOption('start_note_path', notePath, sourceId);
});
res.send(await getRecentNotes());