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: save alias with tag item in db
thecodrr4a49e17652ea
diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.jsindex f32806058..b187ba4fc 100644--- a/packages/core/__tests__/notes.test.js+++ b/packages/core/__tests__/notes.test.js@@ -63,7 +63,7 @@ test("get all notes", () =>test("note without a title should get title from content", () =>noteTest().then(async ({ db, id }) => {let note = db.notes.note(id);- expect(note.title).toBe("HelloThis is colorful");+ expect(note.title).toBe("Hello This is colorful");}));test("note should get headline from content", () =>diff --git a/packages/core/collections/tags.js b/packages/core/collections/tags.jsindex 6742eee37..f04e22f36 100644--- a/packages/core/collections/tags.js+++ b/packages/core/collections/tags.js@@ -6,9 +6,9 @@ import setManipulator from "../utils/set";export default class Tags extends Collection {tag(id) {- const tagItem = this._collection- .getItems()- .find((t) => t.id === id || t.title === id);+ const tagItem = this.all.find(+ (t) => t.id === id || t.title === this.sanitize(id)+ );return tagItem;}@@ -32,6 +32,7 @@ export default class Tags extends Collection {type: "tag",id,title: tag.title,+ alias: tag.title,noteIds: setManipulator.union(notes, noteIds),};@@ -48,6 +49,9 @@ export default class Tags extends Collection {return;}await this._db.settings.setAlias(tagId, newName);++ tag.alias = newName;+ await this._collection.addItem(tag);}alias(tagId) {@@ -56,8 +60,8 @@ export default class Tags extends Collection {console.error(`No tag found. Tag id:`, tagId);return;}- const alias = this._db.settings.getAlias(tagId);- return alias || tag.alias || tag.title;++ return tag.alias || this._db.settings.getAlias(tagId) || tag.title;}get raw() {@@ -66,8 +70,8 @@ export default class Tags extends Collection {get all() {return this._collection.getItems(undefined, (item) => {- const alias = this.alias(item.id);- if (alias) item.alias = alias;+ if (item.alias) return item;+ item.alias = this._db.settings.getAlias(item.id) || tag.title;return item;});}