Skip to content

Build your personal knowledge base with Trilium Notes

Pass deleteId to deleteBranch in ensureNoteIsAbsentFromParent (#846)

jasontan0562375b170ba34
diff --git a/src/services/cloning.js b/src/services/cloning.js
index 0545ea2404..ed991214a0 100644
--- a/src/services/cloning.js
+++ b/src/services/cloning.js
@@ -7,6 +7,7 @@ const noteService = require('./notes');
const repository = require('./repository');
const Branch = require('../entities/branch');
const TaskContext = require("./task_context.js");
+const utils = require('./utils');
async function cloneNoteToParent(noteId, parentNoteId, prefix) {
if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) {
@@ -54,7 +55,8 @@ async function ensureNoteIsAbsentFromParent(noteId, parentNoteId) {
const branch = await repository.getEntity(`SELECT * FROM branches WHERE noteId = ? AND parentNoteId = ? AND isDeleted = 0`, [noteId, parentNoteId]);
if (branch) {
- await noteService.deleteBranch(branch, new TaskContext());
+ const deleteId = utils.randomString(10);
+ await noteService.deleteBranch(branch, deleteId, new TaskContext());
}
}