From 2375b170ba34ed7a466b16898b1e0085866ef750 Mon Sep 17 00:00:00 2001 From: jasontan056 Date: Sat, 1 Feb 2020 16:05:23 +0800 Subject: [PATCH] Pass deleteId to deleteBranch in ensureNoteIsAbsentFromParent (#846) --- src/services/cloning.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/cloning.js b/src/services/cloning.js index 0545ea240..ed991214a 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()); } }