mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	correctly respect label @disableVersioning
This commit is contained in:
		| @@ -12,9 +12,7 @@ const imageminGifLossy = require('imagemin-giflossy'); | ||||
| const jimp = require('jimp'); | ||||
| const imageType = require('image-type'); | ||||
| const sanitizeFilename = require('sanitize-filename'); | ||||
| const dateUtils = require('./date_utils'); | ||||
| const noteRevisionService = require('./note_revisions.js'); | ||||
| const NoteRevision = require("../entities/note_revision"); | ||||
|  | ||||
| async function processImage(uploadBuffer, originalName, shrinkImageSwitch) { | ||||
|     const origImageFormat = imageType(uploadBuffer); | ||||
|   | ||||
| @@ -7,10 +7,6 @@ const dateUtils = require('../services/date_utils'); | ||||
|  * @param {Note} note | ||||
|  */ | ||||
| async function protectNoteRevisions(note) { | ||||
|     if (await note.hasLabel('disableVersioning')) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     for (const revision of await note.getRevisions()) { | ||||
|         if (note.isProtected !== revision.isProtected) { | ||||
|             const content = await revision.getContent(); | ||||
| @@ -30,6 +26,10 @@ async function protectNoteRevisions(note) { | ||||
|  * @return {NoteRevision} | ||||
|  */ | ||||
| async function createNoteRevision(note) { | ||||
|     if (await note.hasLabel("disableVersioning")) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     const noteRevision = await new NoteRevision({ | ||||
|         noteId: note.noteId, | ||||
|         // title and text should be decrypted now | ||||
|   | ||||
| @@ -317,8 +317,7 @@ async function saveLinks(note, content) { | ||||
| } | ||||
|  | ||||
| async function saveNoteRevision(note) { | ||||
|     // files and images are immutable, they can't be updated | ||||
|     // but we don't even version titles which is probably not correct | ||||
|     // files and images are versioned separately | ||||
|     if (note.type === 'file' || note.type === 'image' || await note.hasLabel('disableVersioning')) { | ||||
|         return; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user