Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fixing consistency checks
zadam151687cd9bda
diff --git a/src/routes/api/options.js b/src/routes/api/options.jsindex e526afe8e4..46a6126363 100644--- a/src/routes/api/options.js+++ b/src/routes/api/options.js@@ -2,7 +2,6 @@const optionService = require('../../services/options');const log = require('../../services/log');-const attributes = require('../../services/attributes');const searchService = require('../../services/search/services/search');// options allowed to be updated directly in options dialogdiff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex 5dd0261793..e818b8385e 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -460,35 +460,26 @@ class ConsistencyChecks {runEntityChangeChecks(entityName, key) {this.findAndFixIssues(`- SELECT+ SELECT${key} as entityId- FROM+ FROM${entityName}LEFT JOIN entity_changes ON entity_changes.entityName = '${entityName}'AND entity_changes.entityId = ${key}WHEREentity_changes.id IS NULL`,({entityId}) => {- if (this.autoFix) {- if (entityName === 'note_contents' || entityName === 'note_revision_contents') {- const entity = entityName === 'note_contents'- ? becca.getNote(entityId)- : becca.getNoteRevision(entityId);-- entity.setContent(entity.getContent(), true);- }- else {- const entity = becca.getEntity(entityName, entityId);+ const entity = sql.getRow(`SELECT * FROM ${entityName} WHERE ${key} = ?`, [entityId]);- entityChangesService.addEntityChange({- entityName,- entityId,- hash: entity.generateHash(),- isErased: false,- utcDateChanged: entity.getUtcDateChanged(),- isSynced: entityName !== 'options' || entity.isSynced- });- }+ if (this.autoFix) {+ entityChangesService.addEntityChange({+ entityName,+ entityId,+ hash: utils.randomString(10), // doesn't matter, will force sync but that's OK+ isErased: !!entity.isErased,+ utcDateChanged: entity.utcDateModified || entity.utcDateCreated,+ isSynced: entityName !== 'options' || entity.isSynced+ });logFix(`Created missing entity change for entityName=${entityName}, entityId=${entityId}`);} else {diff --git a/src/services/window.js b/src/services/window.jsindex f7309abadf..25c4bffa1b 100644--- a/src/services/window.js+++ b/src/services/window.js@@ -52,11 +52,6 @@ async function createMainWindow() {const {BrowserWindow} = require('electron'); // should not be statically imported- const nativeImage = require('electron').nativeImage-- const image = nativeImage.createFromPath(getIcon())- console.log(image)-mainWindow = new BrowserWindow({x: mainWindowState.x,y: mainWindowState.y,@@ -70,7 +65,7 @@ async function createMainWindow() {spellcheck: spellcheckEnabled},frame: optionService.getOptionBool('nativeTitleBarVisible'),- icon: image+ icon: getIcon()});mainWindowState.manage(mainWindow);