Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: whole tag being set in title key

thecodrr3e8ec5d410e6
diff --git a/packages/core/collections/tags.js b/packages/core/collections/tags.js
index 50d006230..69f1c952e 100644
--- a/packages/core/collections/tags.js
+++ b/packages/core/collections/tags.js
@@ -11,6 +11,10 @@ export default class Tags extends Collection {
}
async add(tagId, noteId) {
+ if (tagId.id || tagId.title) {
+ tagId = tagId.id;
+ }
+
if (!tagId || !noteId) new Error("tagId and noteId cannot be falsy.");
let tag = this.all.find((t) => t.id === tagId || t.title === tagId) || {
@@ -53,7 +57,7 @@ export default class Tags extends Collection {
if (tag.noteIds.length > 0) await this._collection.addItem(tag);
else {
await this._db.settings.unpin(tag.id);
- await this._collection.removeItem(tag.id);
+ await this._collection.deleteItem(tag.id);
}
}
}
diff --git a/packages/core/database/indexed-collection.js b/packages/core/database/indexed-collection.js
index 7a77c198c..3e268a5c6 100644
--- a/packages/core/database/indexed-collection.js
+++ b/packages/core/database/indexed-collection.js
@@ -42,6 +42,10 @@ export default class IndexedCollection {
});
}
+ deleteItem(id) {
+ return this.indexer.remove(id);
+ }
+
exists(id) {
return this.indexer.exists(id);
}