allow cloning into notes, not just branches, fixes #2484

This commit is contained in:
zadam
2021-12-27 23:39:46 +01:00
parent 3128a7d62f
commit d97e454463
9 changed files with 55 additions and 24 deletions

View File

@@ -2,11 +2,18 @@
const cloningService = require('../../services/cloning');
function cloneNoteToParent(req) {
function cloneNoteToBranch(req) {
const {noteId, parentBranchId} = req.params;
const {prefix} = req.body;
return cloningService.cloneNoteToParent(noteId, parentBranchId, prefix);
return cloningService.cloneNoteToBranch(noteId, parentBranchId, prefix);
}
function cloneNoteToNote(req) {
const {noteId, parentNoteId} = req.params;
const {prefix} = req.body;
return cloningService.cloneNoteToNote(noteId, parentNoteId, prefix);
}
function cloneNoteAfter(req) {
@@ -16,6 +23,7 @@ function cloneNoteAfter(req) {
}
module.exports = {
cloneNoteToParent,
cloneNoteToBranch,
cloneNoteToNote,
cloneNoteAfter
};

View File

@@ -229,7 +229,8 @@ function register(app) {
apiRoute(GET, '/api/edited-notes/:date', noteRevisionsApiRoute.getEditedNotesOnDate);
apiRoute(PUT, '/api/notes/:noteId/clone-to/:parentBranchId', cloningApiRoute.cloneNoteToParent);
apiRoute(PUT, '/api/notes/:noteId/clone-to-branch/:parentBranchId', cloningApiRoute.cloneNoteToBranch);
apiRoute(PUT, '/api/notes/:noteId/clone-to-note/:parentNoteId', cloningApiRoute.cloneNoteToNote);
apiRoute(PUT, '/api/notes/:noteId/clone-after/:afterBranchId', cloningApiRoute.cloneNoteAfter);
route(GET, '/api/notes/:branchId/export/:type/:format/:version/:taskId', [auth.checkApiAuthOrElectron], exportRoute.exportBranch);