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",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.47.1-beta",
"version": "0.47.2",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {

View File

@ -813,6 +813,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
const activeContext = appContext.tabManager.getActiveTabContext();
if (activeContext && activeContext.notePath) {
this.tree.$container.focus();
this.tree.setFocus(true);
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
*
* @method
* @param {string} searchString
* @param {string} query
* @param {Object} [searchParams]
* @returns {Note|null}
*/
this.searchForNote = searchString => {
const notes = searchService.searchNoteEntities(searchString);
this.searchForNote = (query, searchParams = {}) => {
const notes = this.searchForNotes(query, searchParams);
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,31 +80,37 @@ function cleanupEntityChangesForMissingEntities(entityName, entityPrimaryKey) {
function fillEntityChanges(entityName, entityPrimaryKey, condition = '') {
try {
cleanupEntityChangesForMissingEntities(entityName, entityPrimaryKey);
const repository = require("./repository.js");
const entityIds = sql.getColumn(`SELECT ${entityPrimaryKey} FROM ${entityName}`
+ (condition ? ` WHERE ${condition}` : ''));
sql.transactional(() => {
const entityIds = sql.getColumn(`SELECT ${entityPrimaryKey} FROM ${entityName}`
+ (condition ? ` WHERE ${condition}` : ''));
let createdCount = 0;
let createdCount = 0;
for (const entityId of entityIds) {
const existingRows = sql.getValue("SELECT COUNT(1) FROM entity_changes WHERE entityName = ? AND entityId = ?", [entityName, entityId]);
for (const entityId of entityIds) {
const existingRows = sql.getValue("SELECT COUNT(1) FROM entity_changes WHERE entityName = ? AND entityId = ?", [entityName, entityId]);
// we don't want to replace existing entities (which would effectively cause full resync)
if (existingRows === 0) {
createdCount++;
// we don't want to replace existing entities (which would effectively cause full resync)
if (existingRows === 0) {
createdCount++;
sql.insert("entity_changes", {
entityName: entityName,
entityId: entityId,
sourceId: "SYNC_FILL",
isSynced: 1
});
const entity = repository.getEntity(`SELECT * FROM ${entityName} WHERE ${entityPrimaryKey} = ?`, [entityId]);
addEntityChange({
entityName,
entityId,
hash: entity.generateHash(),
isErased: false,
utcDateChanged: entity.getUtcDateChanged()
}, null);
}
}
}
if (createdCount > 0) {
log.info(`Created ${createdCount} missing entity changes for ${entityName}.`);
}
if (createdCount > 0) {
log.info(`Created ${createdCount} missing entity changes for ${entityName}.`);
}
});
}
catch (e) {
// this is to fix migration from 0.30 to 0.32, can be removed later