mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	camelCase builtin labels
This commit is contained in:
		
							
								
								
									
										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; | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user