Merge remote-tracking branch 'origin/master' into next60

This commit is contained in:
zadam
2023-05-04 21:01:53 +02:00
7 changed files with 28 additions and 17 deletions

View File

@@ -8,12 +8,12 @@ const becca = require('../becca/becca');
function validateParentChild(parentNoteId, childNoteId, branchId = null) {
if (['root', '_hidden', '_share', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers'].includes(childNoteId)) {
return { success: false, message: `Cannot change this note's location.`};
return { branch: null, success: false, message: `Cannot change this note's location.`};
}
if (parentNoteId === 'none') {
// this shouldn't happen
return { success: false, message: `Cannot move anything into 'none' parent.` };
return { branch: null, success: false, message: `Cannot move anything into 'none' parent.` };
}
const existing = becca.getBranchFromChildAndParent(childNoteId, parentNoteId);
@@ -23,6 +23,7 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) {
const childNote = becca.getNote(childNoteId);
return {
branch: existing,
success: false,
message: `Note "${childNote.title}" note already exists in the "${parentNote.title}".`
};
@@ -30,6 +31,7 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) {
if (wouldAddingBranchCreateCycle(parentNoteId, childNoteId)) {
return {
branch: null,
success: false,
message: 'Moving/cloning note here would create cycle.'
};
@@ -37,12 +39,13 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) {
if (parentNoteId !== '_lbBookmarks' && becca.getNote(parentNoteId).type === 'launcher') {
return {
branch: null,
success: false,
message: 'Launcher note cannot have any children.'
};
}
return { success: true };
return { branch: null, success: true };
}
/**