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 jimp = require('jimp'); | ||||||
| const imageType = require('image-type'); | const imageType = require('image-type'); | ||||||
| const sanitizeFilename = require('sanitize-filename'); | const sanitizeFilename = require('sanitize-filename'); | ||||||
| const dateUtils = require('./date_utils'); |  | ||||||
| const noteRevisionService = require('./note_revisions.js'); | const noteRevisionService = require('./note_revisions.js'); | ||||||
| const NoteRevision = require("../entities/note_revision"); |  | ||||||
|  |  | ||||||
| async function processImage(uploadBuffer, originalName, shrinkImageSwitch) { | async function processImage(uploadBuffer, originalName, shrinkImageSwitch) { | ||||||
|     const origImageFormat = imageType(uploadBuffer); |     const origImageFormat = imageType(uploadBuffer); | ||||||
|   | |||||||
| @@ -7,10 +7,6 @@ const dateUtils = require('../services/date_utils'); | |||||||
|  * @param {Note} note |  * @param {Note} note | ||||||
|  */ |  */ | ||||||
| async function protectNoteRevisions(note) { | async function protectNoteRevisions(note) { | ||||||
|     if (await note.hasLabel('disableVersioning')) { |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     for (const revision of await note.getRevisions()) { |     for (const revision of await note.getRevisions()) { | ||||||
|         if (note.isProtected !== revision.isProtected) { |         if (note.isProtected !== revision.isProtected) { | ||||||
|             const content = await revision.getContent(); |             const content = await revision.getContent(); | ||||||
| @@ -30,6 +26,10 @@ async function protectNoteRevisions(note) { | |||||||
|  * @return {NoteRevision} |  * @return {NoteRevision} | ||||||
|  */ |  */ | ||||||
| async function createNoteRevision(note) { | async function createNoteRevision(note) { | ||||||
|  |     if (await note.hasLabel("disableVersioning")) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     const noteRevision = await new NoteRevision({ |     const noteRevision = await new NoteRevision({ | ||||||
|         noteId: note.noteId, |         noteId: note.noteId, | ||||||
|         // title and text should be decrypted now |         // title and text should be decrypted now | ||||||
|   | |||||||
| @@ -317,8 +317,7 @@ async function saveLinks(note, content) { | |||||||
| } | } | ||||||
|  |  | ||||||
| async function saveNoteRevision(note) { | async function saveNoteRevision(note) { | ||||||
|     // files and images are immutable, they can't be updated |     // files and images are versioned separately | ||||||
|     // but we don't even version titles which is probably not correct |  | ||||||
|     if (note.type === 'file' || note.type === 'image' || await note.hasLabel('disableVersioning')) { |     if (note.type === 'file' || note.type === 'image' || await note.hasLabel('disableVersioning')) { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user