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
feat: pin/unpin & (un)favorite from the same functions
thecodrr1730926a7e9b
diff --git a/packages/core/api/database.js b/packages/core/api/database.jsindex 2a8f0cb49..fcc1f4b29 100644--- a/packages/core/api/database.js+++ b/packages/core/api/database.js@@ -170,11 +170,11 @@ class Database {}pinItem(type, id) {- return editItem.call(this, type, id, { pinned: true });+ return editItem.call(this, type, id, "pinned");}favoriteItem(type, id) {- return editItem.call(this, type, id, { favorite: true });+ return editItem.call(this, type, id, "favorite");}async deleteNotes(notes) {@@ -504,7 +504,7 @@ function makeTopic(topic) {};}-async function editItem(type, id, edit) {+async function editItem(type, id, prop) {switch (type) {case "notebook":case "note":@@ -513,6 +513,8 @@ async function editItem(type, id, edit) {if (col[id] === undefined) {throw new Error(`Wrong ${type} id.`);}+ let state = col[id][prop];+ let edit = { [prop]: !state };await func.call(this, { ...col[id], ...edit });break;default: