mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
fix creating tree cycle by moving clone into another clone, closes #4442
This commit is contained in:
@@ -19,14 +19,14 @@ const ValidationError = require("../../errors/validation_error");
|
||||
function moveBranchToParent(req) {
|
||||
const {branchId, parentBranchId} = req.params;
|
||||
|
||||
const parentBranch = becca.getBranch(parentBranchId);
|
||||
const branchToMove = becca.getBranch(branchId);
|
||||
const targetParentBranch = becca.getBranch(parentBranchId);
|
||||
|
||||
if (!parentBranch || !branchToMove) {
|
||||
if (!branchToMove || !targetParentBranch) {
|
||||
throw new ValidationError(`One or both branches '${branchId}', '${parentBranchId}' have not been found`);
|
||||
}
|
||||
|
||||
return branchService.moveBranchToBranch(branchToMove, parentBranch, branchId);
|
||||
return branchService.moveBranchToBranch(branchToMove, targetParentBranch, branchId);
|
||||
}
|
||||
|
||||
function moveBranchBeforeNote(req) {
|
||||
|
||||
Reference in New Issue
Block a user