mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	feat(etapi): also save note revision via etapi if needed too (#6602)
This commit is contained in:
		| @@ -29,7 +29,7 @@ describe("etapi/patch-note", () => { | |||||||
|             }) |             }) | ||||||
|             .expect(201); |             .expect(201); | ||||||
|  |  | ||||||
|         const createdNoteId = response.body.note.noteId as string; |         createdNoteId = response.body.note.noteId as string; | ||||||
|         expect(createdNoteId).toBeTruthy(); |         expect(createdNoteId).toBeTruthy(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -92,6 +92,7 @@ function register(router: Router) { | |||||||
|             throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`); |             throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         noteService.saveRevisionIfNeeded(note); | ||||||
|         eu.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH); |         eu.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH); | ||||||
|         note.save(); |         note.save(); | ||||||
|  |  | ||||||
| @@ -136,6 +137,7 @@ function register(router: Router) { | |||||||
|             throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`); |             throw new eu.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI.`); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         noteService.saveRevisionIfNeeded(note); | ||||||
|         note.setContent(req.body); |         note.setContent(req.body); | ||||||
|  |  | ||||||
|         noteService.asyncPostProcessContent(note, req.body); |         noteService.asyncPostProcessContent(note, req.body); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user