mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix toggling protected flag and display of the title
This commit is contained in:
parent
151687cd9b
commit
010f075ac5
@ -57,6 +57,10 @@ class AbstractEntity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPojoToSave() {
|
||||||
|
return this.getPojo();
|
||||||
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
const entityName = this.constructor.entityName;
|
const entityName = this.constructor.entityName;
|
||||||
const primaryKeyName = this.constructor.primaryKeyName;
|
const primaryKeyName = this.constructor.primaryKeyName;
|
||||||
@ -67,7 +71,7 @@ class AbstractEntity {
|
|||||||
this.beforeSaving();
|
this.beforeSaving();
|
||||||
}
|
}
|
||||||
|
|
||||||
const pojo = this.getPojo();
|
const pojo = this.getPojoToSave();
|
||||||
|
|
||||||
sql.transactional(() => {
|
sql.transactional(() => {
|
||||||
sql.upsert(entityName, primaryKeyName, pojo);
|
sql.upsert(entityName, primaryKeyName, pojo);
|
||||||
|
@ -1084,7 +1084,7 @@ class Note extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPojo() {
|
getPojo() {
|
||||||
const pojo = {
|
return {
|
||||||
noteId: this.noteId,
|
noteId: this.noteId,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
isProtected: this.isProtected,
|
isProtected: this.isProtected,
|
||||||
@ -1096,6 +1096,10 @@ class Note extends AbstractEntity {
|
|||||||
utcDateCreated: this.utcDateCreated,
|
utcDateCreated: this.utcDateCreated,
|
||||||
utcDateModified: this.utcDateModified
|
utcDateModified: this.utcDateModified
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getPojoToSave() {
|
||||||
|
const pojo = this.getPojo();
|
||||||
|
|
||||||
if (pojo.isProtected) {
|
if (pojo.isProtected) {
|
||||||
if (this.isDecrypted) {
|
if (this.isDecrypted) {
|
||||||
|
@ -156,7 +156,7 @@ class NoteRevision extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPojo() {
|
getPojo() {
|
||||||
const pojo = {
|
return {
|
||||||
noteRevisionId: this.noteRevisionId,
|
noteRevisionId: this.noteRevisionId,
|
||||||
noteId: this.noteId,
|
noteId: this.noteId,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
@ -169,6 +169,10 @@ class NoteRevision extends AbstractEntity {
|
|||||||
utcDateCreated: this.utcDateCreated,
|
utcDateCreated: this.utcDateCreated,
|
||||||
utcDateModified: this.utcDateModified
|
utcDateModified: this.utcDateModified
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getPojoToSave() {
|
||||||
|
const pojo = this.getPojo();
|
||||||
|
|
||||||
if (pojo.isProtected) {
|
if (pojo.isProtected) {
|
||||||
if (protectedSessionService.isProtectedSessionAvailable()) {
|
if (protectedSessionService.isProtectedSessionAvailable()) {
|
||||||
|
@ -25,6 +25,8 @@ async function processEntityChanges(entityChanges) {
|
|||||||
loadResults.addNoteContent(ec.entityId, ec.sourceId);
|
loadResults.addNoteContent(ec.entityId, ec.sourceId);
|
||||||
} else if (ec.entityName === 'note_revisions') {
|
} else if (ec.entityName === 'note_revisions') {
|
||||||
loadResults.addNoteRevision(ec.entityId, ec.noteId, ec.sourceId);
|
loadResults.addNoteRevision(ec.entityId, ec.noteId, ec.sourceId);
|
||||||
|
} else if (ec.entityName === 'note_revision_contents') {
|
||||||
|
// this should change only when toggling isProtected, ignore
|
||||||
} else if (ec.entityName === 'options') {
|
} else if (ec.entityName === 'options') {
|
||||||
if (ec.entity.name === 'openTabs') {
|
if (ec.entity.name === 'openTabs') {
|
||||||
continue; // only noise
|
continue; // only noise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user