mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 03:58:53 +08:00
fix toggling protected flag and display of the title
This commit is contained in:
parent
151687cd9b
commit
010f075ac5
4 changed files with 17 additions and 3 deletions
|
@ -57,6 +57,10 @@ class AbstractEntity {
|
|||
});
|
||||
}
|
||||
|
||||
getPojoToSave() {
|
||||
return this.getPojo();
|
||||
}
|
||||
|
||||
save() {
|
||||
const entityName = this.constructor.entityName;
|
||||
const primaryKeyName = this.constructor.primaryKeyName;
|
||||
|
@ -67,7 +71,7 @@ class AbstractEntity {
|
|||
this.beforeSaving();
|
||||
}
|
||||
|
||||
const pojo = this.getPojo();
|
||||
const pojo = this.getPojoToSave();
|
||||
|
||||
sql.transactional(() => {
|
||||
sql.upsert(entityName, primaryKeyName, pojo);
|
||||
|
|
|
@ -1084,7 +1084,7 @@ class Note extends AbstractEntity {
|
|||
}
|
||||
|
||||
getPojo() {
|
||||
const pojo = {
|
||||
return {
|
||||
noteId: this.noteId,
|
||||
title: this.title,
|
||||
isProtected: this.isProtected,
|
||||
|
@ -1096,6 +1096,10 @@ class Note extends AbstractEntity {
|
|||
utcDateCreated: this.utcDateCreated,
|
||||
utcDateModified: this.utcDateModified
|
||||
};
|
||||
}
|
||||
|
||||
getPojoToSave() {
|
||||
const pojo = this.getPojo();
|
||||
|
||||
if (pojo.isProtected) {
|
||||
if (this.isDecrypted) {
|
||||
|
|
|
@ -156,7 +156,7 @@ class NoteRevision extends AbstractEntity {
|
|||
}
|
||||
|
||||
getPojo() {
|
||||
const pojo = {
|
||||
return {
|
||||
noteRevisionId: this.noteRevisionId,
|
||||
noteId: this.noteId,
|
||||
type: this.type,
|
||||
|
@ -169,6 +169,10 @@ class NoteRevision extends AbstractEntity {
|
|||
utcDateCreated: this.utcDateCreated,
|
||||
utcDateModified: this.utcDateModified
|
||||
};
|
||||
}
|
||||
|
||||
getPojoToSave() {
|
||||
const pojo = this.getPojo();
|
||||
|
||||
if (pojo.isProtected) {
|
||||
if (protectedSessionService.isProtectedSessionAvailable()) {
|
||||
|
|
|
@ -25,6 +25,8 @@ async function processEntityChanges(entityChanges) {
|
|||
loadResults.addNoteContent(ec.entityId, ec.sourceId);
|
||||
} else if (ec.entityName === 'note_revisions') {
|
||||
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') {
|
||||
if (ec.entity.name === 'openTabs') {
|
||||
continue; // only noise
|
||||
|
|
Loading…
Reference in a new issue