A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: do not add duplicate colors/tags
thecodrr7158b1b2e426
diff --git a/packages/core/api/database.js b/packages/core/api/database.jsindex 54b92a909..6e1458789 100644--- a/packages/core/api/database.js+++ b/packages/core/api/database.js@@ -131,6 +131,21 @@ class Database {.split(" ").slice(0, 3).join(" ");++ //if note exists+ if (this.notes[timestamp] !== undefined) {+ let oldNote = this.notes[timestamp];+ //if we are having new colors+ if (oldNote.colors !== note.colors) {+ note.colors = mergeDedupe(oldNote.colors, note.colors);+ }+ //if we are having new tags+ //TODO add new tags to the tags collection...+ if (oldNote.tags !== note.tags) {+ note.tags = mergeDedupe(oldNote.tags, note.tags);+ }+ }+this.notes[timestamp] = {type: "note",title,@@ -504,3 +519,7 @@ async function editItem(type, id, edit) {throw new Error("Invalid type given to pinItem");}}++function mergeDedupe(arr) {+ return [...new Set([].concat(...arr))];+}