From f5e87db988a7668929d7c75c859f4c36f8320b4b Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 18 Dec 2017 22:37:31 -0500 Subject: [PATCH] making sure that recent notes don't try to display deleted notes --- routes/api/recent_notes.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/routes/api/recent_notes.js b/routes/api/recent_notes.js index a79505c94..cbf50cf5d 100644 --- a/routes/api/recent_notes.js +++ b/routes/api/recent_notes.js @@ -34,7 +34,17 @@ router.put('/:noteTreeId/:notePath', auth.checkApiAuth, async (req, res, next) = }); async function getRecentNotes() { - return await sql.getResults("SELECT * FROM recent_notes WHERE is_deleted = 0 ORDER BY date_accessed DESC"); + return await sql.getResults(` + SELECT + recent_notes.* + FROM + recent_notes + JOIN notes_tree USING(note_tree_id) + WHERE + recent_notes.is_deleted = 0 + AND notes_tree.is_deleted = 0 + ORDER BY + date_accessed DESC`); } module.exports = router; \ No newline at end of file