mirror of
https://github.com/zadam/trilium.git
synced 2025-02-22 22:13:07 +08:00
fix ensureNoteIsAbsentFromParent, closes #691
This commit is contained in:
parent
d8730f1722
commit
9b905563c3
2 changed files with 3 additions and 2 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.36.2",
|
"version": "0.36.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -6,6 +6,7 @@ const treeService = require('./tree');
|
||||||
const noteService = require('./notes');
|
const noteService = require('./notes');
|
||||||
const repository = require('./repository');
|
const repository = require('./repository');
|
||||||
const Branch = require('../entities/branch');
|
const Branch = require('../entities/branch');
|
||||||
|
const TaskContext = require("./task_context.js");
|
||||||
|
|
||||||
async function cloneNoteToParent(noteId, parentNoteId, prefix) {
|
async function cloneNoteToParent(noteId, parentNoteId, prefix) {
|
||||||
if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) {
|
if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) {
|
||||||
|
@ -53,7 +54,7 @@ async function ensureNoteIsAbsentFromParent(noteId, parentNoteId) {
|
||||||
const branch = await repository.getEntity(`SELECT * FROM branches WHERE noteId = ? AND parentNoteId = ? AND isDeleted = 0`, [noteId, parentNoteId]);
|
const branch = await repository.getEntity(`SELECT * FROM branches WHERE noteId = ? AND parentNoteId = ? AND isDeleted = 0`, [noteId, parentNoteId]);
|
||||||
|
|
||||||
if (branch) {
|
if (branch) {
|
||||||
await noteService.deleteBranch(branch);
|
await noteService.deleteBranch(branch, new TaskContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue