mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
correctly respect label @disableVersioning
(cherry picked from commit dc063983ea736f338e1d01d0863ee6f5ae40b2ee)
This commit is contained in:
parent
e9454e4db7
commit
f740e52ebf
@ -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
|
||||
|
@ -308,8 +308,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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user