mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: handle promises properly (2)
This commit is contained in:
@@ -358,12 +358,12 @@ function notebookTopicFn(notebookId, topic, fn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function topicNoteFn(notebookId, topic, noteId, fn) {
|
function topicNoteFn(notebookId, topic, noteId, fn) {
|
||||||
return notebookTopicFn.call(this, notebookId, topic, notebook => {
|
return notebookTopicFn.call(this, notebookId, topic, async notebook => {
|
||||||
let topicIndex = notebook.topics.findIndex(t => t.title === topic);
|
let topicIndex = notebook.topics.findIndex(t => t.title === topic);
|
||||||
if (topicIndex === -1 || !this.notes.hasOwnProperty(noteId)) return false;
|
if (topicIndex === -1 || !this.notes.hasOwnProperty(noteId)) return false;
|
||||||
|
|
||||||
if (fn(notebook, topicIndex)) {
|
if ((await fn(notebook, topicIndex)) === true) {
|
||||||
return this.storage.write(KEYS.notes, this.notes).then(s => true);
|
return await this.storage.write(KEYS.notes, this.notes).then(s => true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user