Skip to content

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

fix: minor issues with settings api

thecodrr3733ad8904ce
diff --git a/packages/core/api/settings.js b/packages/core/api/settings.js
index 221a18ce3..e6849dd0a 100644
--- a/packages/core/api/settings.js
+++ b/packages/core/api/settings.js
@@ -14,14 +14,14 @@ class Settings {
}
async pin(type, data) {
- if (type !== "notebook" || type !== "topic" || type !== "tag")
+ if (type !== "notebook" && type !== "topic" && type !== "tag")
throw new Error("This item cannot be pinned.");
- this._settings.pins.push({ id, data });
+ this._settings.pins.push({ type, data });
await this._db.context.write("settings", this._settings);
}
async unpin(id) {
- const index = this._settings.pins.findIndex((i) => i.id === id);
+ const index = this._settings.pins.findIndex((i) => i.data.id === id);
if (index <= -1) return;
this._settings.pins.splice(index, 1);
await this._db.context.write("settings", this._settings);
@@ -33,7 +33,7 @@ class Settings {
return this._db.notebooks.notebook(pin.data.id).data;
} else if (pin.type === "topic") {
return this._db.notebooks
- .notebook(pin.data.id)
+ .notebook(pin.data.notebookId)
.topics.topic(pin.data.topic)._topic;
} else if (pin.type === "tag") {
return this._db.tags.tag(pin.data.id);