Skip to content

Build your personal knowledge base with Trilium Notes

fix putting new attribute correctly into becca

zadam5ca7e398521f
diff --git a/src/public/app/widgets/bulk_actions/execute_script.js b/src/public/app/widgets/bulk_actions/execute_script.js
index 62ba11f744..69d8e3cd9c 100644
--- a/src/public/app/widgets/bulk_actions/execute_script.js
+++ b/src/public/app/widgets/bulk_actions/execute_script.js
@@ -44,7 +44,7 @@ export default class ExecuteScriptBulkAction extends AbstractBulkAction {
const spacedUpdate = new SpacedUpdate(async () => {
await this.saveAction({ script: $script.val() });
- }, 1000)
+ }, 1000);
$script.on('input', () => spacedUpdate.scheduleUpdate());
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index 779df212e4..5b973d5e47 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -431,7 +431,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
notes = JSON.parse(jsonStr);
}
catch (e) {
- logError(`Cannot parse ${jsonStr} into notes for drop`);
+ logError(`Cannot parse JSON '${jsonStr}' into notes for drop`);
return;
}
diff --git a/src/routes/api/attributes.js b/src/routes/api/attributes.js
index 63435991ba..31f544c1c7 100644
--- a/src/routes/api/attributes.js
+++ b/src/routes/api/attributes.js
@@ -91,10 +91,7 @@ function addNoteAttribute(req) {
const noteId = req.params.noteId;
const body = req.body;
- const attr = new Attribute(body);
- attr.noteId = noteId;
-
- attr.save();
+ new Attribute({...body, noteId}).save();
}
function deleteNoteAttribute(req) {
diff --git a/src/services/bulk_actions.js b/src/services/bulk_actions.js
index b13513a353..ada23c7483 100644
--- a/src/services/bulk_actions.js
+++ b/src/services/bulk_actions.js
@@ -4,8 +4,6 @@ const becca = require("../becca/becca");
const cloningService = require("./cloning");
const branchService = require("./branches");
const utils = require("./utils");
-const dayjs = require("dayjs");
-const cls = require("./cls.js");
const ACTION_HANDLERS = {
addLabel: (action, note) => {
@@ -77,6 +75,8 @@ const ACTION_HANDLERS = {
const targetParentNote = becca.getNote(action.targetParentNoteId);
if (!targetParentNote) {
+ log.info(`Cannot execute moveNote because note ${action.targetParentNoteId} doesn't exist.`);
+
return;
}