From d1ed730b54ec58905b94b0373d602a924ac0cf11 Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 23 Aug 2017 23:42:26 -0400 Subject: [PATCH] fixed recent list for cloned notes --- static/js/note.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/note.js b/static/js/note.js index 44125e171..7eb644ae6 100644 --- a/static/js/note.js +++ b/static/js/note.js @@ -161,25 +161,25 @@ function loadNote(noteId) { $(window).resize(); // to trigger resizing of editor - addRecentNote(noteId, note.detail.note_title); + addRecentNote(noteId, note.detail.note_id, note.detail.note_title); noteChangeDisabled = false; }); } -function addRecentNote(noteId, noteTitle) { +function addRecentNote(noteTreeId, noteContentId, noteTitle) { const origDate = new Date(); setTimeout(function() { // we include the note into recent list only if the user stayed on the note at least 5 seconds - if (noteId === globalNote.detail.note_id) { + if (noteTreeId === globalNote.detail.note_id || noteContentId === globalNote.detail.note_id) { // if it's already there, remove the note - recentNotes = recentNotes.filter(note => note.noteId !== noteId); + recentNotes = recentNotes.filter(note => note.noteId !== noteTreeId); console.log("added after " + (new Date().getTime() - origDate.getTime())); recentNotes.unshift({ - noteId: noteId, + noteId: noteTreeId, noteTitle: noteTitle }); }