From 6f567e3e10b287d32bcb590c7d817975a27387c0 Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 2 Apr 2018 21:56:55 -0400 Subject: [PATCH] camelCase builtin labels --- db/migrations/0083__camelCase_labels.sql | 7 +++++++ src/routes/api/export.js | 2 +- src/routes/api/tree.js | 2 +- src/routes/index.js | 2 +- src/scripts/Reddit Importer.tar | Bin 10731 -> 10727 bytes src/scripts/Weight Tracker.tar | Bin 224227 -> 224224 bytes src/services/app_info.js | 2 +- src/services/date_notes.js | 2 +- src/services/labels.js | 16 +++++++--------- src/services/notes.js | 2 +- src/services/script.js | 4 ++-- 11 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 db/migrations/0083__camelCase_labels.sql diff --git a/db/migrations/0083__camelCase_labels.sql b/db/migrations/0083__camelCase_labels.sql new file mode 100644 index 000000000..fa318b6c4 --- /dev/null +++ b/db/migrations/0083__camelCase_labels.sql @@ -0,0 +1,7 @@ +UPDATE labels SET name = 'disableVersioning' WHERE name = 'disable_versioning'; +UPDATE labels SET name = 'calendarRoot' WHERE name = 'calendar_root'; +UPDATE labels SET name = 'hideInAutocomplete' WHERE name = 'hide_in_autocomplete'; +UPDATE labels SET name = 'excludeFromExport' WHERE name = 'exclude_from_export'; +UPDATE labels SET name = 'manualTransactionHandling' WHERE name = 'manual_transaction_handling'; +UPDATE labels SET name = 'disableInclusion' WHERE name = 'disable_inclusion'; +UPDATE labels SET name = 'appCss' WHERE name = 'app_css'; \ No newline at end of file diff --git a/src/routes/api/export.js b/src/routes/api/export.js index a988e0904..e5cf87aeb 100644 --- a/src/routes/api/export.js +++ b/src/routes/api/export.js @@ -33,7 +33,7 @@ async function exportNoteInner(branchId, directory, pack) { const metadata = await getMetadata(note); - if (metadata.labels.find(label => label.name === 'exclude_from_export')) { + if (metadata.labels.find(label => label.name === 'excludeFromExport')) { return; } diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js index 9276582a1..f0e251e15 100644 --- a/src/routes/api/tree.js +++ b/src/routes/api/tree.js @@ -38,7 +38,7 @@ async function getTree() { FROM notes LEFT JOIN labels AS hideInAutocomplete ON hideInAutocomplete.noteId = notes.noteId - AND hideInAutocomplete.name = 'hide_in_autocomplete' + AND hideInAutocomplete.name = 'hideInAutocomplete' AND hideInAutocomplete.isDeleted = 0 WHERE notes.isDeleted = 0`)); diff --git a/src/routes/index.js b/src/routes/index.js index d5157135d..d31138446 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -16,7 +16,7 @@ async function index(req, res) { async function getAppCss() { let css = ''; - const notes = labelService.getNotesWithLabel('app_css'); + const notes = labelService.getNotesWithLabel('appCss'); for (const note of await notes) { css += `/* ${note.noteId} */ diff --git a/src/scripts/Reddit Importer.tar b/src/scripts/Reddit Importer.tar index 24ff66938fa7ef5198c552a341537518fbe594fe..f501cbb05254f3a5a336ec6379fb60a19878e26b 100644 GIT binary patch delta 34 qcmaDI{5*KWPbQv_qQt!7#N?99{5+4%?940pnLYCyH*XO#7Y6_a5Dhc{ delta 38 ucmaDJ{5p8UPbR+jlA^@C;>6^V%>2CgjLodfEBIOCGxOpTH*XL!7Y6`HbPp~7 diff --git a/src/scripts/Weight Tracker.tar b/src/scripts/Weight Tracker.tar index 2e3b4f44b03da16f6fcc2b73569f7db9e190faf2..b2346ce36d6a08ea0c6754ef3bb5b59772605c47 100644 GIT binary patch delta 38 scmaESo%g|Y-VN0{jA6~SI_BLDyZ delta 41 vcmaEGo%iu|-VN0{Oz~ySH9GAzI*dTfw7o`$d6yMyd}dyJ;&#h)=H)B^X~qwn diff --git a/src/services/app_info.js b/src/services/app_info.js index f3a6d3ea5..5501db8d8 100644 --- a/src/services/app_info.js +++ b/src/services/app_info.js @@ -3,7 +3,7 @@ const build = require('./build'); const packageJson = require('../../package'); -const APP_DB_VERSION = 81; +const APP_DB_VERSION = 83; module.exports = { app_version: packageJson.version, diff --git a/src/services/date_notes.js b/src/services/date_notes.js index 65730cc81..ec1ac8afc 100644 --- a/src/services/date_notes.js +++ b/src/services/date_notes.js @@ -5,7 +5,7 @@ const noteService = require('./notes'); const labelService = require('./labels'); const dateUtils = require('./date_utils'); -const CALENDAR_ROOT_LABEL = 'calendar_root'; +const CALENDAR_ROOT_LABEL = 'calendarRoot'; const YEAR_LABEL = 'year_note'; const MONTH_LABEL = 'month_note'; const DATE_LABEL = 'date_note'; diff --git a/src/services/labels.js b/src/services/labels.js index 1a15a0306..97b3c00de 100644 --- a/src/services/labels.js +++ b/src/services/labels.js @@ -5,16 +5,14 @@ const repository = require('./repository'); const Label = require('../entities/label'); const BUILTIN_LABELS = [ - 'frontend_startup', - 'backend_startup', - 'disable_versioning', - 'calendar_root', - 'hide_in_autocomplete', - 'exclude_from_export', + 'disableVersioning', + 'calendarRoot', + 'hideInAutocomplete', + 'excludeFromExport', 'run', - 'manual_transaction_handling', - 'disable_inclusion', - 'app_css' + 'manualTransactionHandling', + 'disableInclusion', + 'appCss' ]; async function getNoteLabelMap(noteId) { diff --git a/src/services/notes.js b/src/services/notes.js index b8e274f82..e602e064c 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -175,7 +175,7 @@ async function saveNoteRevision(note) { const msSinceDateCreated = now.getTime() - dateUtils.parseDateTime(note.dateCreated).getTime(); if (note.type !== 'file' - && labelsMap.disable_versioning !== 'true' + && labelsMap.disableVersioning !== 'true' && !existingnoteRevisionId && msSinceDateCreated >= noteRevisionSnapshotTimeInterval * 1000) { diff --git a/src/services/script.js b/src/services/script.js index 51f973eff..dadb0b17f 100644 --- a/src/services/script.js +++ b/src/services/script.js @@ -23,7 +23,7 @@ async function executeBundle(bundle, startNote) { const ctx = new ScriptContext(startNote, bundle.allNotes); - if (await bundle.note.hasLabel('manual_transaction_handling')) { + if (await bundle.note.hasLabel('manualTransactionHandling')) { return await execute(ctx, script, ''); } else { @@ -72,7 +72,7 @@ async function getScriptBundle(note, root = true, scriptEnv = null, includedNote return; } - if (!root && await note.hasLabel('disable_inclusion')) { + if (!root && await note.hasLabel('disableInclusion')) { return; }