Merge branch 'master' into next

This commit is contained in:
zadam 2021-04-29 22:09:48 +02:00
commit 43eb248450
5 changed files with 31 additions and 23 deletions

View File

@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.47.1-beta", "version": "0.47.2",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {

View File

@ -813,6 +813,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
const activeContext = appContext.tabManager.getActiveTabContext(); const activeContext = appContext.tabManager.getActiveTabContext();
if (activeContext && activeContext.notePath) { if (activeContext && activeContext.notePath) {
this.tree.$container.focus();
this.tree.setFocus(true); this.tree.setFocus(true);
const node = await this.expandToNote(activeContext.notePath); const node = await this.expandToNote(activeContext.notePath);

View File

@ -122,11 +122,12 @@ function BackendScriptApi(currentNote, apiParams) {
* "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
* *
* @method * @method
* @param {string} searchString * @param {string} query
* @param {Object} [searchParams]
* @returns {Note|null} * @returns {Note|null}
*/ */
this.searchForNote = searchString => { this.searchForNote = (query, searchParams = {}) => {
const notes = searchService.searchNoteEntities(searchString); const notes = this.searchForNotes(query, searchParams);
return notes.length > 0 ? notes[0] : null; return notes.length > 0 ? notes[0] : null;
}; };

View File

@ -1 +1 @@
module.exports = { buildDate:"2021-04-19T22:43:03+02:00", buildRevision: "6136243d6117910b80feafad4fc7121ecc42d794" }; module.exports = { buildDate:"2021-04-26T22:32:54+02:00", buildRevision: "6f1b0b92fe8dcea736c15217c69512c7fee769cb" };

View File

@ -80,7 +80,9 @@ function cleanupEntityChangesForMissingEntities(entityName, entityPrimaryKey) {
function fillEntityChanges(entityName, entityPrimaryKey, condition = '') { function fillEntityChanges(entityName, entityPrimaryKey, condition = '') {
try { try {
cleanupEntityChangesForMissingEntities(entityName, entityPrimaryKey); cleanupEntityChangesForMissingEntities(entityName, entityPrimaryKey);
const repository = require("./repository.js");
sql.transactional(() => {
const entityIds = sql.getColumn(`SELECT ${entityPrimaryKey} FROM ${entityName}` const entityIds = sql.getColumn(`SELECT ${entityPrimaryKey} FROM ${entityName}`
+ (condition ? ` WHERE ${condition}` : '')); + (condition ? ` WHERE ${condition}` : ''));
@ -93,18 +95,22 @@ function fillEntityChanges(entityName, entityPrimaryKey, condition = '') {
if (existingRows === 0) { if (existingRows === 0) {
createdCount++; createdCount++;
sql.insert("entity_changes", { const entity = repository.getEntity(`SELECT * FROM ${entityName} WHERE ${entityPrimaryKey} = ?`, [entityId]);
entityName: entityName,
entityId: entityId, addEntityChange({
sourceId: "SYNC_FILL", entityName,
isSynced: 1 entityId,
}); hash: entity.generateHash(),
isErased: false,
utcDateChanged: entity.getUtcDateChanged()
}, null);
} }
} }
if (createdCount > 0) { if (createdCount > 0) {
log.info(`Created ${createdCount} missing entity changes for ${entityName}.`); log.info(`Created ${createdCount} missing entity changes for ${entityName}.`);
} }
});
} }
catch (e) { catch (e) {
// this is to fix migration from 0.30 to 0.32, can be removed later // this is to fix migration from 0.30 to 0.32, can be removed later