mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge remote-tracking branch 'origin/stable'
This commit is contained in:
commit
928c8bfdf7
@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start-server": "cross-env TRILIUM_ENV=dev node ./src/www",
|
"start-server": "cross-env TRILIUM_ENV=dev node ./src/www",
|
||||||
"start-electron": "cross-env TRILIUM_ENV=dev electron .",
|
"start-electron": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .",
|
||||||
"build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/entities/*.js src/services/backend_script_api.js",
|
"build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/entities/*.js src/services/backend_script_api.js",
|
||||||
"build-frontend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js",
|
"build-frontend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js",
|
||||||
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs",
|
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs",
|
||||||
|
@ -156,14 +156,14 @@ class Note extends Entity {
|
|||||||
|
|
||||||
sql.upsert("note_contents", "noteId", pojo);
|
sql.upsert("note_contents", "noteId", pojo);
|
||||||
|
|
||||||
const hash = utils.hash(this.noteId + "|" + content.toString());
|
const hash = utils.hash(this.noteId + "|" + pojo.content.toString());
|
||||||
|
|
||||||
entityChangesService.addEntityChange({
|
entityChangesService.addEntityChange({
|
||||||
entityName: 'note_contents',
|
entityName: 'note_contents',
|
||||||
entityId: this.noteId,
|
entityId: this.noteId,
|
||||||
hash: hash,
|
hash: hash,
|
||||||
isErased: false,
|
isErased: false,
|
||||||
utcDateChanged: this.getUtcDateChanged()
|
utcDateChanged: pojo.utcDateModified
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
||||||
|
|
||||||
await server.put(`notes/${this.noteId}/change-title`, {title});
|
await server.put(`notes/${this.noteId}/change-title`, {title}, this.componentId);
|
||||||
});
|
});
|
||||||
|
|
||||||
appContext.addBeforeUnloadListener(this);
|
appContext.addBeforeUnloadListener(this);
|
||||||
|
@ -5,6 +5,7 @@ const noteCacheService = require('../../services/note_cache/note_cache_service')
|
|||||||
const protectedSessionService = require('../../services/protected_session');
|
const protectedSessionService = require('../../services/protected_session');
|
||||||
const noteRevisionService = require('../../services/note_revisions');
|
const noteRevisionService = require('../../services/note_revisions');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils');
|
||||||
|
const sql = require('../../services/sql');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
function getNoteRevisions(req) {
|
function getNoteRevisions(req) {
|
||||||
|
@ -233,7 +233,7 @@ async function findSimilarNotes(noteId) {
|
|||||||
|
|
||||||
const baseNote = noteCache.notes[noteId];
|
const baseNote = noteCache.notes[noteId];
|
||||||
|
|
||||||
if (!baseNote) {
|
if (!baseNote || !baseNote.utcDateCreated) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ function updateEntity(entityChange, entity, sourceId) {
|
|||||||
? updateNoteReordering(entityChange, entity, sourceId)
|
? updateNoteReordering(entityChange, entity, sourceId)
|
||||||
: updateNormalEntity(entityChange, entity, sourceId);
|
: updateNormalEntity(entityChange, entity, sourceId);
|
||||||
|
|
||||||
// currently making exception for protected notes and note revisions because here
|
if (updated && !entityChange.isErased) {
|
||||||
// the title and content are not available decrypted as listeners would expect
|
|
||||||
if (updated && !entity.isProtected && !entityChange.isErased) {
|
|
||||||
eventService.emit(eventService.ENTITY_SYNCED, {
|
eventService.emit(eventService.ENTITY_SYNCED, {
|
||||||
entityName: entityChange.entityName,
|
entityName: entityChange.entityName,
|
||||||
entity
|
entity
|
||||||
@ -44,7 +42,7 @@ function updateNormalEntity(remoteEntityChange, entity, sourceId) {
|
|||||||
|
|
||||||
if (localEntityChange && !localEntityChange.isErased && remoteEntityChange.isErased) {
|
if (localEntityChange && !localEntityChange.isErased && remoteEntityChange.isErased) {
|
||||||
sql.transactional(() => {
|
sql.transactional(() => {
|
||||||
const primaryKey = entityConstructor.getEntityFromEntityName(entityName).primaryKeyName;
|
const primaryKey = entityConstructor.getEntityFromEntityName(remoteEntityChange.entityName).primaryKeyName;
|
||||||
|
|
||||||
sql.execute(`DELETE FROM ${remoteEntityChange.entityName} WHERE ${primaryKey} = ?`, remoteEntityChange.entityId);
|
sql.execute(`DELETE FROM ${remoteEntityChange.entityName} WHERE ${primaryKey} = ?`, remoteEntityChange.entityId);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user