From 02016ed0319345a277baf231a88d8bc246506fd2 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 27 Feb 2021 21:19:54 +0100 Subject: [PATCH] fix create full search note --- src/routes/api/date_notes.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/api/date_notes.js b/src/routes/api/date_notes.js index 02fb51813..03c4ccee9 100644 --- a/src/routes/api/date_notes.js +++ b/src/routes/api/date_notes.js @@ -66,7 +66,9 @@ function createSearchNote(req) { const searchString = params.searchString || ""; let ancestorNoteId = params.ancestorNoteId; - const hoistedNote = cls.getHoistedNoteId() ? repository.getNote(cls.getHoistedNoteId()) : null; + const hoistedNote = cls.getHoistedNoteId() && cls.getHoistedNoteId() !== 'root' + ? repository.getNote(cls.getHoistedNoteId()) + : null; let searchHome; @@ -81,7 +83,7 @@ function createSearchNote(req) { || dateNoteService.getDateNote(today); } - if (hoistedNote && hoistedNote.noteId !== 'root') { + if (hoistedNote) { if (!hoistedNote.getDescendantNoteIds().includes(searchHome.noteId)) { // otherwise the note would be saved outside of the hoisted context which is weird