mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
renamed hideInAutocomplete label to archived
This commit is contained in:
parent
c8c533844e
commit
385144451b
1
db/migrations/0098__rename_hideInAutocomplete.sql
Normal file
1
db/migrations/0098__rename_hideInAutocomplete.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
UPDATE labels SET name = 'archived' WHERE name = 'hideInAutocomplete'
|
@ -6,7 +6,7 @@ class NoteShort {
|
|||||||
this.isProtected = row.isProtected;
|
this.isProtected = row.isProtected;
|
||||||
this.type = row.type;
|
this.type = row.type;
|
||||||
this.mime = row.mime;
|
this.mime = row.mime;
|
||||||
this.hideInAutocomplete = row.hideInAutocomplete;
|
this.archived = row.archived;
|
||||||
}
|
}
|
||||||
|
|
||||||
isJson() {
|
isJson() {
|
||||||
@ -59,7 +59,7 @@ class NoteShort {
|
|||||||
get dto() {
|
get dto() {
|
||||||
const dto = Object.assign({}, this);
|
const dto = Object.assign({}, this);
|
||||||
delete dto.treeCache;
|
delete dto.treeCache;
|
||||||
delete dto.hideInAutocomplete;
|
delete dto.archived;
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
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 = 97;
|
const APP_DB_VERSION = 98;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
appVersion: packageJson.version,
|
appVersion: packageJson.version,
|
||||||
|
@ -6,7 +6,7 @@ const Label = require('../entities/label');
|
|||||||
const BUILTIN_LABELS = [
|
const BUILTIN_LABELS = [
|
||||||
'disableVersioning',
|
'disableVersioning',
|
||||||
'calendarRoot',
|
'calendarRoot',
|
||||||
'hideInAutocomplete',
|
'archived',
|
||||||
'excludeFromExport',
|
'excludeFromExport',
|
||||||
'run',
|
'run',
|
||||||
'manualTransactionHandling',
|
'manualTransactionHandling',
|
||||||
|
@ -10,7 +10,7 @@ let protectedNoteTitles;
|
|||||||
let noteIds;
|
let noteIds;
|
||||||
let childParentToBranchId = {};
|
let childParentToBranchId = {};
|
||||||
const childToParent = {};
|
const childToParent = {};
|
||||||
const hideInAutocomplete = {};
|
const archived = {};
|
||||||
|
|
||||||
// key is 'childNoteId-parentNoteId' as a replacement for branchId which we don't use here
|
// key is 'childNoteId-parentNoteId' as a replacement for branchId which we don't use here
|
||||||
let prefixes = {};
|
let prefixes = {};
|
||||||
@ -29,10 +29,10 @@ async function load() {
|
|||||||
childParentToBranchId[`${rel.noteId}-${rel.parentNoteId}`] = rel.branchId;
|
childParentToBranchId[`${rel.noteId}-${rel.parentNoteId}`] = rel.branchId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hiddenLabels = await sql.getColumn(`SELECT noteId FROM labels WHERE isDeleted = 0 AND name = 'hideInAutocomplete'`);
|
const hiddenLabels = await sql.getColumn(`SELECT noteId FROM labels WHERE isDeleted = 0 AND name = 'archived'`);
|
||||||
|
|
||||||
for (const noteId of hiddenLabels) {
|
for (const noteId of hiddenLabels) {
|
||||||
hideInAutocomplete[noteId] = true;
|
archived[noteId] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ function findNotes(query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const noteId of noteIds) {
|
for (const noteId of noteIds) {
|
||||||
if (hideInAutocomplete[noteId]) {
|
if (archived[noteId]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ function findNotes(query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const parentNoteId of parents) {
|
for (const parentNoteId of parents) {
|
||||||
if (hideInAutocomplete[parentNoteId]) {
|
if (archived[parentNoteId]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ function search(noteId, tokens, path, results) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentNoteId === 'root' || hideInAutocomplete[parentNoteId]) {
|
if (parentNoteId === 'root' || archived[parentNoteId]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ function getSomePath(noteId, path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const parentNoteId of parents) {
|
for (const parentNoteId of parents) {
|
||||||
if (hideInAutocomplete[parentNoteId]) {
|
if (archived[parentNoteId]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,16 +261,16 @@ eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entityId
|
|||||||
else if (entityName === 'labels') {
|
else if (entityName === 'labels') {
|
||||||
const label = await repository.getLabel(entityId);
|
const label = await repository.getLabel(entityId);
|
||||||
|
|
||||||
if (label.name === 'hideInAutocomplete') {
|
if (label.name === 'archived') {
|
||||||
// we're not using label object directly, since there might be other non-deleted hideInAutocomplete label
|
// we're not using label object directly, since there might be other non-deleted archived label
|
||||||
const hideLabel = await repository.getEntity(`SELECT * FROM labels WHERE isDeleted = 0
|
const hideLabel = await repository.getEntity(`SELECT * FROM labels WHERE isDeleted = 0
|
||||||
AND name = 'hideInAutocomplete' AND noteId = ?`, [label.noteId]);
|
AND name = 'archived' AND noteId = ?`, [label.noteId]);
|
||||||
|
|
||||||
if (hideLabel) {
|
if (hideLabel) {
|
||||||
hideInAutocomplete[label.noteId] = true;
|
archived[label.noteId] = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
delete hideInAutocomplete[label.noteId];
|
delete archived[label.noteId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user