mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	allow deleting protected notes outside of protected session
This commit is contained in:
		| @@ -358,10 +358,12 @@ async function deleteNote(branch) { | |||||||
|     const notDeletedBranches = await note.getBranches(); |     const notDeletedBranches = await note.getBranches(); | ||||||
|  |  | ||||||
|     if (notDeletedBranches.length === 0) { |     if (notDeletedBranches.length === 0) { | ||||||
|         note.isDeleted = true; |         // maybe a bit counter-intuitively, protected notes can be deleted also outside of protected session | ||||||
|         // we don't reset content here, that's postponed and done later to give the user |         // this is because protected notes offer only confidentiality which makes some things simpler - e.g. deletion UI | ||||||
|         // a chance to correct a mistake |         // to allow this, we just set the isDeleted flag, otherwise saving would fail because of attempt to encrypt | ||||||
|         await note.save(); |         // content with non-existent protected session key | ||||||
|  |         // we don't reset content here, that's postponed and done later to give the user a chance to correct a mistake | ||||||
|  |         await sql.execute("UPDATE notes SET isDeleted = 1 WHERE noteId = ?", [note.noteId]); | ||||||
|  |  | ||||||
|         for (const noteRevision of await note.getRevisions()) { |         for (const noteRevision of await note.getRevisions()) { | ||||||
|             await noteRevision.save(); |             await noteRevision.save(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user