diff --git a/public/javascripts/dialogs/edit_tree_prefix.js b/public/javascripts/dialogs/edit_tree_prefix.js index 9ec3c41e4..eb0c36b3d 100644 --- a/public/javascripts/dialogs/edit_tree_prefix.js +++ b/public/javascripts/dialogs/edit_tree_prefix.js @@ -30,7 +30,7 @@ const editTreePrefix = (function() { formEl.submit(() => { const prefix = treePrefixInputEl.val(); - server.put('tree/' + noteTreeId + '/setPrefix', { + server.put('tree/' + noteTreeId + '/set-prefix', { prefix: prefix }).then(() => noteTree.setPrefix(noteTreeId, prefix)); diff --git a/public/javascripts/protected_session.js b/public/javascripts/protected_session.js index 2cdb21ab7..dfa1ead8d 100644 --- a/public/javascripts/protected_session.js +++ b/public/javascripts/protected_session.js @@ -141,7 +141,7 @@ const protected_session = (function() { async function protectSubTree(noteId, protect) { await ensureProtectedSession(true, true); - await server.put('tree/' + noteId + "/protectSubTree/" + (protect ? 1 : 0)); + await server.put('tree/' + noteId + "/protect-sub-tree/" + (protect ? 1 : 0)); showMessage("Request to un/protect sub tree has finished successfully"); diff --git a/public/javascripts/tree_changes.js b/public/javascripts/tree_changes.js index 26f6ea5f4..94e8dc0cb 100644 --- a/public/javascripts/tree_changes.js +++ b/public/javascripts/tree_changes.js @@ -2,7 +2,7 @@ const treeChanges = (function() { async function moveBeforeNode(node, beforeNode, changeInPath = true) { - await server.put('notes/' + node.data.note_tree_id + '/moveBefore/' + beforeNode.data.note_tree_id); + await server.put('notes/' + node.data.note_tree_id + '/move-before/' + beforeNode.data.note_tree_id); node.moveTo(beforeNode, 'before'); @@ -14,7 +14,7 @@ const treeChanges = (function() { } async function moveAfterNode(node, afterNode, changeInPath = true) { - await server.put('notes/' + node.data.note_tree_id + '/moveAfter/' + afterNode.data.note_tree_id); + await server.put('notes/' + node.data.note_tree_id + '/move-after/' + afterNode.data.note_tree_id); node.moveTo(afterNode, 'after'); @@ -27,7 +27,7 @@ const treeChanges = (function() { // beware that first arg is noteId and second is noteTreeId! async function cloneNoteAfter(noteId, afterNoteTreeId) { - const resp = await server.put('notes/' + noteId + '/cloneAfter/' + afterNoteTreeId); + const resp = await server.put('notes/' + noteId + '/clone-after/' + afterNoteTreeId); if (!resp.success) { alert(resp.message); @@ -38,7 +38,7 @@ const treeChanges = (function() { } async function moveToNode(node, toNode) { - await server.put('notes/' + node.data.note_tree_id + '/moveTo/' + toNode.data.note_id); + await server.put('notes/' + node.data.note_tree_id + '/move-to/' + toNode.data.note_id); node.moveTo(toNode); @@ -53,7 +53,7 @@ const treeChanges = (function() { } async function cloneNoteTo(childNoteId, parentNoteId) { - const resp = await server.put('notes/' + childNoteId + '/cloneTo/' + parentNoteId); + const resp = await server.put('notes/' + childNoteId + '/clone-to/' + parentNoteId); if (!resp.success) { alert(resp.message); @@ -95,7 +95,7 @@ const treeChanges = (function() { return; } - await server.put('notes/' + node.data.note_tree_id + '/moveAfter/' + node.getParent().data.note_tree_id); + await server.put('notes/' + node.data.note_tree_id + '/move-after/' + node.getParent().data.note_tree_id); if (node.getParent() !== null && node.getParent().getChildren().length <= 1) { node.getParent().folder = false; diff --git a/routes/api/notes_move.js b/routes/api/notes_move.js index 6d392cf5f..7d1d105a7 100644 --- a/routes/api/notes_move.js +++ b/routes/api/notes_move.js @@ -7,7 +7,7 @@ const utils = require('../../services/utils'); const auth = require('../../services/auth'); const sync_table = require('../../services/sync_table'); -router.put('/:noteTreeId/moveTo/:parentNoteId', auth.checkApiAuth, async (req, res, next) => { +router.put('/:noteTreeId/move-to/:parentNoteId', auth.checkApiAuth, async (req, res, next) => { const noteTreeId = req.params.noteTreeId; const parentNoteId = req.params.parentNoteId; @@ -26,7 +26,7 @@ router.put('/:noteTreeId/moveTo/:parentNoteId', auth.checkApiAuth, async (req, r res.send({}); }); -router.put('/:noteTreeId/moveBefore/:beforeNoteTreeId', async (req, res, next) => { +router.put('/:noteTreeId/move-before/:beforeNoteTreeId', async (req, res, next) => { const noteTreeId = req.params.noteTreeId; const beforeNoteTreeId = req.params.beforeNoteTreeId; @@ -55,7 +55,7 @@ router.put('/:noteTreeId/moveBefore/:beforeNoteTreeId', async (req, res, next) = } }); -router.put('/:noteTreeId/moveAfter/:afterNoteTreeId', async (req, res, next) => { +router.put('/:noteTreeId/move-after/:afterNoteTreeId', async (req, res, next) => { const noteTreeId = req.params.noteTreeId; const afterNoteTreeId = req.params.afterNoteTreeId; @@ -82,7 +82,7 @@ router.put('/:noteTreeId/moveAfter/:afterNoteTreeId', async (req, res, next) => } }); -router.put('/:childNoteId/cloneTo/:parentNoteId', auth.checkApiAuth, async (req, res, next) => { +router.put('/:childNoteId/clone-to/:parentNoteId', auth.checkApiAuth, async (req, res, next) => { const parentNoteId = req.params.parentNoteId; const childNoteId = req.params.childNoteId; @@ -126,7 +126,7 @@ router.put('/:childNoteId/cloneTo/:parentNoteId', auth.checkApiAuth, async (req, }); }); -router.put('/:noteId/cloneAfter/:afterNoteTreeId', async (req, res, next) => { +router.put('/:noteId/clone-after/:afterNoteTreeId', async (req, res, next) => { const noteId = req.params.noteId; const afterNoteTreeId = req.params.afterNoteTreeId; diff --git a/routes/api/tree.js b/routes/api/tree.js index ad6ca27df..50186750d 100644 --- a/routes/api/tree.js +++ b/routes/api/tree.js @@ -35,7 +35,7 @@ router.get('/', auth.checkApiAuth, async (req, res, next) => { }); }); -router.put('/:noteId/protectSubTree/:isProtected', auth.checkApiAuth, async (req, res, next) => { +router.put('/:noteId/protect-sub-tree/:isProtected', auth.checkApiAuth, async (req, res, next) => { const noteId = req.params.noteId; const isProtected = !!parseInt(req.params.isProtected); const dataKey = protected_session.getDataKey(req); @@ -47,7 +47,7 @@ router.put('/:noteId/protectSubTree/:isProtected', auth.checkApiAuth, async (req res.send({}); }); -router.put('/:noteTreeId/setPrefix', auth.checkApiAuth, async (req, res, next) => { +router.put('/:noteTreeId/set-prefix', auth.checkApiAuth, async (req, res, next) => { const noteTreeId = req.params.noteTreeId; const prefix = utils.isEmptyOrWhitespace(req.body.prefix) ? null : req.body.prefix;