mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
expose ability to create note revisions in backend API #2890
This commit is contained in:
@@ -491,7 +491,7 @@ function saveLinks(note, content) {
|
||||
return content;
|
||||
}
|
||||
|
||||
function saveNoteRevision(note) {
|
||||
function saveNoteRevisionIfNeeded(note) {
|
||||
// files and images are versioned separately
|
||||
if (note.type === 'file' || note.type === 'image' || note.hasLabel('disableVersioning')) {
|
||||
return;
|
||||
@@ -508,7 +508,7 @@ function saveNoteRevision(note) {
|
||||
const msSinceDateCreated = now.getTime() - dateUtils.parseDateTime(note.utcDateCreated).getTime();
|
||||
|
||||
if (!existingNoteRevisionId && msSinceDateCreated >= noteRevisionSnapshotTimeInterval * 1000) {
|
||||
noteRevisionService.createNoteRevision(note);
|
||||
note.saveNoteRevision();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ function updateNote(noteId, noteUpdates) {
|
||||
throw new Error(`Note '${noteId}' is not available for change!`);
|
||||
}
|
||||
|
||||
saveNoteRevision(note);
|
||||
saveNoteRevisionIfNeeded(note);
|
||||
|
||||
// if protected status changed, then we need to encrypt/decrypt the content anyway
|
||||
if (['file', 'image'].includes(note.type) && note.isProtected !== noteUpdates.isProtected) {
|
||||
@@ -910,6 +910,6 @@ module.exports = {
|
||||
triggerNoteTitleChanged,
|
||||
eraseDeletedNotesNow,
|
||||
eraseNotesWithDeleteId,
|
||||
saveNoteRevision,
|
||||
saveNoteRevisionIfNeeded,
|
||||
downloadImages
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user