Skip to content

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

fix: unpin tags/notebooks/topics from menu on delete

thecodrr1eaf2ba929c0
diff --git a/packages/core/collections/notebooks.js b/packages/core/collections/notebooks.js
index 311f51c42..f684ce266 100644
--- a/packages/core/collections/notebooks.js
+++ b/packages/core/collections/notebooks.js
@@ -87,6 +87,7 @@ export default class Notebooks extends Collection {
if (!notebook) continue;
await notebook.topics.delete(...notebook.data.topics);
await this._collection.removeItem(id);
+ await this._db.settings.unpin(id);
await this._db.trash.add(notebook.data);
}
}
diff --git a/packages/core/collections/tags.js b/packages/core/collections/tags.js
index 1a9179e32..50d006230 100644
--- a/packages/core/collections/tags.js
+++ b/packages/core/collections/tags.js
@@ -51,6 +51,9 @@ export default class Tags extends Collection {
throw new Error(`No note of id "${noteId}" exists in this tag.`);
tag.noteIds.splice(noteIndex, 1);
if (tag.noteIds.length > 0) await this._collection.addItem(tag);
- else await this._collection.removeItem(tag.id);
+ else {
+ await this._db.settings.unpin(tag.id);
+ await this._collection.removeItem(tag.id);
+ }
}
}
diff --git a/packages/core/collections/topics.js b/packages/core/collections/topics.js
index 3a0fed79b..e8eeaf4a0 100644
--- a/packages/core/collections/topics.js
+++ b/packages/core/collections/topics.js
@@ -102,6 +102,7 @@ export default class Topics {
let index = topicIds.findIndex((id) => topic.id === id);
let t = this.topic(topic);
await t.delete(...topic.notes);
+ await this._db.settings.unpin(topic.id);
if (index > -1) {
allTopics.splice(i, 1);
}