mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	note history snapshots now have date from and date to
This commit is contained in:
		| @@ -42,24 +42,26 @@ router.put('/:noteId', async (req, res, next) => { | ||||
|  | ||||
|     const historyCutoff = now - historySnapshotTimeInterval; | ||||
|  | ||||
|     const history = await sql.getSingleResult("select id from notes_history where note_id = ? and date_modified >= ?", [noteId, historyCutoff]); | ||||
|     const history = await sql.getSingleResult("select id from notes_history where note_id = ? and date_modified_from >= ?", [noteId, historyCutoff]); | ||||
|  | ||||
|     await sql.beginTransaction(); | ||||
|  | ||||
|     if (history) { | ||||
|         await sql.execute("update notes_history set note_title = ?, note_text = ?, encryption = ? where id = ?", [ | ||||
|         await sql.execute("update notes_history set note_title = ?, note_text = ?, encryption = ?, date_modified_to = ? where id = ?", [ | ||||
|             note['detail']['note_title'], | ||||
|             note['detail']['note_text'], | ||||
|             note['detail']['encryption'], | ||||
|             now, | ||||
|             history['id'] | ||||
|         ]); | ||||
|     } | ||||
|     else { | ||||
|         await sql.execute("insert into notes_history (note_id, note_title, note_text, encryption, date_modified) values (?, ?, ?, ?, ?)", [ | ||||
|         await sql.execute("insert into notes_history (note_id, note_title, note_text, encryption, date_modified_from, date_modified_to) values (?, ?, ?, ?, ?, ?)", [ | ||||
|             noteId, | ||||
|             note['detail']['note_title'], | ||||
|             note['detail']['note_text'], | ||||
|             note['detail']['encryption'], | ||||
|             now, | ||||
|             now | ||||
|         ]); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user