mirror of
https://github.com/zadam/trilium.git
synced 2025-01-29 02:18:18 +08:00
camelCase builtin labels
This commit is contained in:
parent
c6c76ba360
commit
6f567e3e10
11 changed files with 22 additions and 17 deletions
7
db/migrations/0083__camelCase_labels.sql
Normal file
7
db/migrations/0083__camelCase_labels.sql
Normal file
|
@ -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';
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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`));
|
||||
|
|
|
@ -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} */
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -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,
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue