mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 20:06:08 +01:00
fixed recent notes
This commit is contained in:
@@ -4,7 +4,7 @@ const options = require('./options');
|
||||
const fs = require('fs-extra');
|
||||
const log = require('./log');
|
||||
|
||||
const APP_DB_VERSION = 40;
|
||||
const APP_DB_VERSION = 41;
|
||||
const MIGRATIONS_DIR = "migrations";
|
||||
|
||||
async function migrate() {
|
||||
|
||||
@@ -194,7 +194,7 @@ async function readAndPushEntity(sync, syncContext) {
|
||||
entity = await sql.getSingleResult('SELECT * FROM options WHERE opt_name = ?', [sync.entity_id]);
|
||||
}
|
||||
else if (sync.entity_name === 'recent_notes') {
|
||||
entity = await sql.getSingleResult('SELECT * FROM recent_notes WHERE note_tree_id = ?', [sync.entity_id]);
|
||||
entity = await sql.getSingleResult('SELECT * FROM recent_notes WHERE note_path = ?', [sync.entity_id]);
|
||||
}
|
||||
else {
|
||||
throw new Error("Unrecognized entity type " + sync.entity_name);
|
||||
|
||||
@@ -22,8 +22,8 @@ async function addOptionsSync(optName, sourceId) {
|
||||
await addEntitySync("options", optName, sourceId);
|
||||
}
|
||||
|
||||
async function addRecentNoteSync(noteTreeId, sourceId) {
|
||||
await addEntitySync("recent_notes", noteTreeId, sourceId);
|
||||
async function addRecentNoteSync(notePath, sourceId) {
|
||||
await addEntitySync("recent_notes", notePath, sourceId);
|
||||
}
|
||||
|
||||
async function addEntitySync(entityName, entityId, sourceId) {
|
||||
|
||||
@@ -106,7 +106,7 @@ async function updateOptions(entity, sourceId) {
|
||||
}
|
||||
|
||||
async function updateRecentNotes(entity, sourceId) {
|
||||
const orig = await sql.getSingleResultOrNull("select * from recent_notes where note_tree_id = ?", [entity.note_tree_id]);
|
||||
const orig = await sql.getSingleResultOrNull("select * from recent_notes where note_path = ?", [entity.note_path]);
|
||||
|
||||
if (orig === null || orig.date_accessed < entity.date_accessed) {
|
||||
await sql.doInTransaction(async () => {
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
function newNoteId() {
|
||||
return randomString(12);
|
||||
return randomString(8);
|
||||
}
|
||||
|
||||
function newNoteTreeId() {
|
||||
return randomString(8);
|
||||
return randomString(12);
|
||||
}
|
||||
|
||||
function newNoteHistoryId() {
|
||||
|
||||
Reference in New Issue
Block a user