mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
delete/undelete fixes
This commit is contained in:
parent
14f3c783f2
commit
17b23d92ef
@ -418,14 +418,16 @@ async function deleteBranch(branch, deleteId, taskContext) {
|
||||
const notDeletedBranches = await note.getBranches();
|
||||
|
||||
if (notDeletedBranches.length === 0) {
|
||||
note.isDeleted = true;
|
||||
note.deleteId = deleteId;
|
||||
await note.save();
|
||||
|
||||
for (const childBranch of await note.getChildBranches()) {
|
||||
await deleteBranch(childBranch, deleteId, taskContext);
|
||||
}
|
||||
|
||||
// first delete children and then parent - this will show up better in recent changes
|
||||
|
||||
note.isDeleted = true;
|
||||
note.deleteId = deleteId;
|
||||
await note.save();
|
||||
|
||||
for (const attribute of await note.getOwnedAttributes()) {
|
||||
attribute.isDeleted = true;
|
||||
attribute.deleteId = deleteId;
|
||||
@ -508,7 +510,7 @@ async function undeleteBranch(branch, deleteId, taskContext) {
|
||||
AND branches.parentNoteId = ?`, [deleteId, note.noteId]);
|
||||
|
||||
for (const childBranch of childBranches) {
|
||||
await deleteBranch(childBranch, deleteId, taskContext);
|
||||
await undeleteBranch(childBranch, deleteId, taskContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ const sql = require('./sql');
|
||||
const ScriptContext = require('./script_context');
|
||||
const repository = require('./repository');
|
||||
const cls = require('./cls');
|
||||
const sourceIdService = require('./source_id');
|
||||
const log = require('./log');
|
||||
|
||||
async function executeNote(note, apiParams) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user