diff --git a/src/public/javascripts/services/context_menu.js b/src/public/javascripts/services/context_menu.js
index 48a5ea37b..33cbb57cd 100644
--- a/src/public/javascripts/services/context_menu.js
+++ b/src/public/javascripts/services/context_menu.js
@@ -86,21 +86,21 @@ const contextMenuOptions = {
{title: "----"},
{title: "Edit branch prefix F2", cmd: "editBranchPrefix", uiIcon: "ui-icon-pencil"},
{title: "----"},
- {title: "Protect branch", cmd: "protectBranch", uiIcon: "ui-icon-locked"},
- {title: "Unprotect branch", cmd: "unprotectBranch", uiIcon: "ui-icon-unlocked"},
+ {title: "Protect subtree", cmd: "protectSubtree", uiIcon: "ui-icon-locked"},
+ {title: "Unprotect subtree", cmd: "unprotectSubtree", uiIcon: "ui-icon-unlocked"},
{title: "----"},
{title: "Copy / clone Ctrl+C", cmd: "copy", uiIcon: "ui-icon-copy"},
{title: "Cut Ctrl+X", cmd: "cut", uiIcon: "ui-icon-scissors"},
{title: "Paste into Ctrl+V", cmd: "pasteInto", uiIcon: "ui-icon-clipboard"},
{title: "Paste after", cmd: "pasteAfter", uiIcon: "ui-icon-clipboard"},
{title: "----"},
- {title: "Export subtree", cmd: "exportSubTree", uiIcon: " ui-icon-arrowthick-1-ne", children: [
- {title: "Native Tar", cmd: "exportSubTreeToTar"},
- {title: "OPML", cmd: "exportSubTreeToOpml"}
+ {title: "Export subtree", cmd: "exportSubtree", uiIcon: " ui-icon-arrowthick-1-ne", children: [
+ {title: "Native Tar", cmd: "exportSubtreeToTar"},
+ {title: "OPML", cmd: "exportSubtreeToOpml"}
]},
- {title: "Import into branch (tar, opml)", cmd: "importBranch", uiIcon: "ui-icon-arrowthick-1-sw"},
+ {title: "Import into note (tar, opml)", cmd: "importIntoNote", uiIcon: "ui-icon-arrowthick-1-sw"},
{title: "----"},
- {title: "Collapse branch Alt+-", cmd: "collapseBranch", uiIcon: "ui-icon-minus"},
+ {title: "Collapse subtree Alt+-", cmd: "collapseSubtree", uiIcon: "ui-icon-minus"},
{title: "Force note sync", cmd: "forceNoteSync", uiIcon: "ui-icon-refresh"},
{title: "Sort alphabetically Alt+S", cmd: "sortAlphabetically", uiIcon: " ui-icon-arrowthick-2-n-s"}
],
@@ -119,8 +119,8 @@ const contextMenuOptions = {
$tree.contextmenu("enableEntry", "cut", isNotRoot);
$tree.contextmenu("enableEntry", "pasteAfter", clipboardIds.length > 0 && isNotRoot && parentNote.type !== 'search');
$tree.contextmenu("enableEntry", "pasteInto", clipboardIds.length > 0 && note.type !== 'search');
- $tree.contextmenu("enableEntry", "importBranch", note.type !== 'search');
- $tree.contextmenu("enableEntry", "exportSubTree", note.type !== 'search');
+ $tree.contextmenu("enableEntry", "importIntoNote", note.type !== 'search');
+ $tree.contextmenu("enableEntry", "exportSubtree", note.type !== 'search');
$tree.contextmenu("enableEntry", "editBranchPrefix", isNotRoot && parentNote.type !== 'search');
// Activate node on right-click
@@ -145,11 +145,11 @@ const contextMenuOptions = {
else if (ui.cmd === "editBranchPrefix") {
branchPrefixDialog.showDialog(node);
}
- else if (ui.cmd === "protectBranch") {
- protectedSessionService.protectBranch(node.data.noteId, true);
+ else if (ui.cmd === "protectSubtree") {
+ protectedSessionService.protectSubtree(node.data.noteId, true);
}
- else if (ui.cmd === "unprotectBranch") {
- protectedSessionService.protectBranch(node.data.noteId, false);
+ else if (ui.cmd === "unprotectSubtree") {
+ protectedSessionService.protectSubtree(node.data.noteId, false);
}
else if (ui.cmd === "copy") {
copy(treeService.getSelectedNodes());
@@ -166,16 +166,16 @@ const contextMenuOptions = {
else if (ui.cmd === "delete") {
treeChangesService.deleteNodes(treeService.getSelectedNodes(true));
}
- else if (ui.cmd === "exportSubTreeToTar") {
- exportService.exportSubTree(node.data.noteId, 'tar');
+ else if (ui.cmd === "exportSubtreeToTar") {
+ exportService.exportSubtree(node.data.noteId, 'tar');
}
- else if (ui.cmd === "exportSubTreeToOpml") {
- exportService.exportSubTree(node.data.noteId, 'opml');
+ else if (ui.cmd === "exportSubtreeToOpml") {
+ exportService.exportSubtree(node.data.noteId, 'opml');
}
- else if (ui.cmd === "importBranch") {
- exportService.importBranch(node.data.noteId);
+ else if (ui.cmd === "importIntoNote") {
+ exportService.importIntoNote(node.data.noteId);
}
- else if (ui.cmd === "collapseBranch") {
+ else if (ui.cmd === "collapseSubtree") {
treeService.collapseTree(node);
}
else if (ui.cmd === "forceNoteSync") {
diff --git a/src/public/javascripts/services/export.js b/src/public/javascripts/services/export.js
index 7111d1f5e..4357fd5e7 100644
--- a/src/public/javascripts/services/export.js
+++ b/src/public/javascripts/services/export.js
@@ -3,7 +3,7 @@ import protectedSessionHolder from './protected_session_holder.js';
import utils from './utils.js';
import server from './server.js';
-function exportSubTree(noteId, format) {
+function exportSubtree(noteId, format) {
const url = utils.getHost() + "/api/notes/" + noteId + "/export/" + format +
"?protectedSessionId=" + encodeURIComponent(protectedSessionHolder.getProtectedSessionId());
@@ -12,7 +12,7 @@ function exportSubTree(noteId, format) {
let importNoteId;
-function importBranch(noteId) {
+function importIntoNote(noteId) {
importNoteId = noteId;
$("#import-upload").trigger('click');
@@ -35,6 +35,6 @@ $("#import-upload").change(async function() {
});
export default {
- exportSubTree,
- importBranch
+ exportSubtree,
+ importIntoNote
};
\ No newline at end of file
diff --git a/src/public/javascripts/services/protected_session.js b/src/public/javascripts/services/protected_session.js
index d77f6bf30..60a91e65a 100644
--- a/src/public/javascripts/services/protected_session.js
+++ b/src/public/javascripts/services/protected_session.js
@@ -148,7 +148,7 @@ async function unprotectNoteAndSendToServer() {
noteDetailService.setNoteBackgroundIfProtected(note);
}
-async function protectBranch(noteId, protect) {
+async function protectSubtree(noteId, protect) {
await ensureProtectedSession(true, true);
await server.put('notes/' + noteId + "/protect/" + (protect ? 1 : 0));
@@ -172,7 +172,7 @@ export default {
ensureProtectedSession,
protectNoteAndSendToServer,
unprotectNoteAndSendToServer,
- protectBranch,
+ protectSubtree,
ensureDialogIsClosed,
enterProtectedSession,
leaveProtectedSession
diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js
index 1f4412f53..97cddb8bd 100644
--- a/src/routes/api/notes.js
+++ b/src/routes/api/notes.js
@@ -45,7 +45,7 @@ async function sortNotes(req) {
await treeService.sortNotesAlphabetically(noteId);
}
-async function protectBranch(req) {
+async function protectSubtree(req) {
const noteId = req.params.noteId;
const note = await repository.getNote(noteId);
const protect = !!parseInt(req.params.isProtected);
@@ -70,6 +70,6 @@ module.exports = {
updateNote,
createNote,
sortNotes,
- protectBranch,
+ protectSubtree,
setNoteTypeMime
};
\ No newline at end of file
diff --git a/src/routes/routes.js b/src/routes/routes.js
index d12ef77b9..c3a9356e7 100644
--- a/src/routes/routes.js
+++ b/src/routes/routes.js
@@ -117,7 +117,7 @@ function register(app) {
apiRoute(PUT, '/api/notes/:noteId', notesApiRoute.updateNote);
apiRoute(POST, '/api/notes/:parentNoteId/children', notesApiRoute.createNote);
apiRoute(PUT, '/api/notes/:noteId/sort', notesApiRoute.sortNotes);
- apiRoute(PUT, '/api/notes/:noteId/protect/:isProtected', notesApiRoute.protectBranch);
+ apiRoute(PUT, '/api/notes/:noteId/protect/:isProtected', notesApiRoute.protectSubtree);
apiRoute(PUT, /\/api\/notes\/(.*)\/type\/(.*)\/mime\/(.*)/, notesApiRoute.setNoteTypeMime);
apiRoute(GET, '/api/notes/:noteId/revisions', noteRevisionsApiRoute.getNoteRevisions);
diff --git a/src/services/notes.js b/src/services/notes.js
index 7575184df..3b79712fa 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -193,14 +193,14 @@ async function saveNoteRevision(note) {
const revisionCutoff = dateUtils.dateStr(new Date(now.getTime() - noteRevisionSnapshotTimeInterval * 1000));
- const existingnoteRevisionId = await sql.getValue(
+ const existingNoteRevisionId = await sql.getValue(
"SELECT noteRevisionId FROM note_revisions WHERE noteId = ? AND dateModifiedTo >= ?", [note.noteId, revisionCutoff]);
const msSinceDateCreated = now.getTime() - dateUtils.parseDateTime(note.dateCreated).getTime();
if (note.type !== 'file'
&& !await note.hasLabel('disableVersioning')
- && !existingnoteRevisionId
+ && !existingNoteRevisionId
&& msSinceDateCreated >= noteRevisionSnapshotTimeInterval * 1000) {
await new NoteRevision({
diff --git a/src/services/tree.js b/src/services/tree.js
index a8a9e282e..53515784b 100644
--- a/src/services/tree.js
+++ b/src/services/tree.js
@@ -34,17 +34,17 @@ async function getExistingBranch(parentNoteId, childNoteId) {
* Tree cycle can be created when cloning or when moving existing clone. This method should detect both cases.
*/
async function checkTreeCycle(parentNoteId, childNoteId) {
- const subTreeNoteIds = [];
+ const subtreeNoteIds = [];
// we'll load the whole sub tree - because the cycle can start in one of the notes in the sub tree
- await loadSubTreeNoteIds(childNoteId, subTreeNoteIds);
+ await loadSubtreeNoteIds(childNoteId, subtreeNoteIds);
async function checkTreeCycleInner(parentNoteId) {
if (parentNoteId === 'root') {
return true;
}
- if (subTreeNoteIds.includes(parentNoteId)) {
+ if (subtreeNoteIds.includes(parentNoteId)) {
// while towards the root of the tree we encountered noteId which is already present in the subtree
// joining parentNoteId with childNoteId would then clearly create a cycle
return false;
@@ -68,13 +68,13 @@ async function getBranch(branchId) {
return sql.getRow("SELECT * FROM branches WHERE branchId = ?", [branchId]);
}
-async function loadSubTreeNoteIds(parentNoteId, subTreeNoteIds) {
- subTreeNoteIds.push(parentNoteId);
+async function loadSubtreeNoteIds(parentNoteId, subtreeNoteIds) {
+ subtreeNoteIds.push(parentNoteId);
const children = await sql.getColumn("SELECT noteId FROM branches WHERE parentNoteId = ? AND isDeleted = 0", [parentNoteId]);
for (const childNoteId of children) {
- await loadSubTreeNoteIds(childNoteId, subTreeNoteIds);
+ await loadSubtreeNoteIds(childNoteId, subtreeNoteIds);
}
}