mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
camelCase builtin labels
This commit is contained in:
parent
c6c76ba360
commit
6f567e3e10
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);
|
const metadata = await getMetadata(note);
|
||||||
|
|
||||||
if (metadata.labels.find(label => label.name === 'exclude_from_export')) {
|
if (metadata.labels.find(label => label.name === 'excludeFromExport')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ async function getTree() {
|
|||||||
FROM
|
FROM
|
||||||
notes
|
notes
|
||||||
LEFT JOIN labels AS hideInAutocomplete ON hideInAutocomplete.noteId = notes.noteId
|
LEFT JOIN labels AS hideInAutocomplete ON hideInAutocomplete.noteId = notes.noteId
|
||||||
AND hideInAutocomplete.name = 'hide_in_autocomplete'
|
AND hideInAutocomplete.name = 'hideInAutocomplete'
|
||||||
AND hideInAutocomplete.isDeleted = 0
|
AND hideInAutocomplete.isDeleted = 0
|
||||||
WHERE
|
WHERE
|
||||||
notes.isDeleted = 0`));
|
notes.isDeleted = 0`));
|
||||||
|
@ -16,7 +16,7 @@ async function index(req, res) {
|
|||||||
|
|
||||||
async function getAppCss() {
|
async function getAppCss() {
|
||||||
let css = '';
|
let css = '';
|
||||||
const notes = labelService.getNotesWithLabel('app_css');
|
const notes = labelService.getNotesWithLabel('appCss');
|
||||||
|
|
||||||
for (const note of await notes) {
|
for (const note of await notes) {
|
||||||
css += `/* ${note.noteId} */
|
css += `/* ${note.noteId} */
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -3,7 +3,7 @@
|
|||||||
const build = require('./build');
|
const build = require('./build');
|
||||||
const packageJson = require('../../package');
|
const packageJson = require('../../package');
|
||||||
|
|
||||||
const APP_DB_VERSION = 81;
|
const APP_DB_VERSION = 83;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
app_version: packageJson.version,
|
app_version: packageJson.version,
|
||||||
|
@ -5,7 +5,7 @@ const noteService = require('./notes');
|
|||||||
const labelService = require('./labels');
|
const labelService = require('./labels');
|
||||||
const dateUtils = require('./date_utils');
|
const dateUtils = require('./date_utils');
|
||||||
|
|
||||||
const CALENDAR_ROOT_LABEL = 'calendar_root';
|
const CALENDAR_ROOT_LABEL = 'calendarRoot';
|
||||||
const YEAR_LABEL = 'year_note';
|
const YEAR_LABEL = 'year_note';
|
||||||
const MONTH_LABEL = 'month_note';
|
const MONTH_LABEL = 'month_note';
|
||||||
const DATE_LABEL = 'date_note';
|
const DATE_LABEL = 'date_note';
|
||||||
|
@ -5,16 +5,14 @@ const repository = require('./repository');
|
|||||||
const Label = require('../entities/label');
|
const Label = require('../entities/label');
|
||||||
|
|
||||||
const BUILTIN_LABELS = [
|
const BUILTIN_LABELS = [
|
||||||
'frontend_startup',
|
'disableVersioning',
|
||||||
'backend_startup',
|
'calendarRoot',
|
||||||
'disable_versioning',
|
'hideInAutocomplete',
|
||||||
'calendar_root',
|
'excludeFromExport',
|
||||||
'hide_in_autocomplete',
|
|
||||||
'exclude_from_export',
|
|
||||||
'run',
|
'run',
|
||||||
'manual_transaction_handling',
|
'manualTransactionHandling',
|
||||||
'disable_inclusion',
|
'disableInclusion',
|
||||||
'app_css'
|
'appCss'
|
||||||
];
|
];
|
||||||
|
|
||||||
async function getNoteLabelMap(noteId) {
|
async function getNoteLabelMap(noteId) {
|
||||||
|
@ -175,7 +175,7 @@ async function saveNoteRevision(note) {
|
|||||||
const msSinceDateCreated = now.getTime() - dateUtils.parseDateTime(note.dateCreated).getTime();
|
const msSinceDateCreated = now.getTime() - dateUtils.parseDateTime(note.dateCreated).getTime();
|
||||||
|
|
||||||
if (note.type !== 'file'
|
if (note.type !== 'file'
|
||||||
&& labelsMap.disable_versioning !== 'true'
|
&& labelsMap.disableVersioning !== 'true'
|
||||||
&& !existingnoteRevisionId
|
&& !existingnoteRevisionId
|
||||||
&& msSinceDateCreated >= noteRevisionSnapshotTimeInterval * 1000) {
|
&& msSinceDateCreated >= noteRevisionSnapshotTimeInterval * 1000) {
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ async function executeBundle(bundle, startNote) {
|
|||||||
|
|
||||||
const ctx = new ScriptContext(startNote, bundle.allNotes);
|
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, '');
|
return await execute(ctx, script, '');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -72,7 +72,7 @@ async function getScriptBundle(note, root = true, scriptEnv = null, includedNote
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!root && await note.hasLabel('disable_inclusion')) {
|
if (!root && await note.hasLabel('disableInclusion')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user