Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
add ignoreMissing flag to becca's getNotes()
zadam7261ab69bc09
diff --git a/package.json b/package.jsonindex e215d67379..a0fb97420e 100644--- a/package.json+++ b/package.json@@ -90,7 +90,7 @@"jsdoc": "3.6.7","lorem-ipsum": "2.0.3","rcedit": "3.0.1",- "webpack": "5.45.1",+ "webpack": "5.46.0","webpack-cli": "4.7.2"},"optionalDependencies": {diff --git a/src/becca/becca.js b/src/becca/becca.jsindex eed48199c6..d6f32cb3ab 100644--- a/src/becca/becca.js+++ b/src/becca/becca.js@@ -55,13 +55,17 @@ class Becca {return this.notes[noteId];}- getNotes(noteIds) {+ getNotes(noteIds, ignoreMissing = false) {const filteredNotes = [];for (const noteId of noteIds) {const note = this.notes[noteId];if (!note) {+ if (ignoreMissing) {+ continue;+ }+throw new Error(`Note '${noteId}' was not found in becca.`);}diff --git a/src/routes/api/note_revisions.js b/src/routes/api/note_revisions.jsindex 8d23dcf1df..47459dd43a 100644--- a/src/routes/api/note_revisions.js+++ b/src/routes/api/note_revisions.js@@ -120,7 +120,7 @@ function getEditedNotesOnDate(req) {ORDER BY isDeletedLIMIT 50`, {date: req.params.date + '%'});- const notes = becca.getNotes(noteIds);+ const notes = becca.getNotes(noteIds, true);for (const note of notes) {const notePath = note.isDeleted ? null : beccaService.getNotePath(note.noteId);