mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	refreshing protected session when loading and saving protected notes
This commit is contained in:
		
							parent
							
								
									892aa39d46
								
							
						
					
					
						commit
						98a2322b37
					
				@ -60,6 +60,10 @@ const noteEditor = (function() {
 | 
				
			|||||||
        updateNoteFromInputs(note);
 | 
					        updateNoteFromInputs(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await saveNoteToServer(note);
 | 
					        await saveNoteToServer(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (note.detail.is_protected) {
 | 
				
			||||||
 | 
					            protected_session.touchProtectedSession();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function parseHtml(contents, note) {
 | 
					    function parseHtml(contents, note) {
 | 
				
			||||||
@ -196,6 +200,10 @@ const noteEditor = (function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        await protected_session.ensureProtectedSession(currentNote.detail.is_protected, false);
 | 
					        await protected_session.ensureProtectedSession(currentNote.detail.is_protected, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (currentNote.detail.is_protected) {
 | 
				
			||||||
 | 
					            protected_session.touchProtectedSession();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        noteDetailWrapperEl.show();
 | 
					        noteDetailWrapperEl.show();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // this may fal if the dialog has not been previously opened
 | 
					        // this may fal if the dialog has not been previously opened
 | 
				
			||||||
@ -260,8 +268,6 @@ const noteEditor = (function() {
 | 
				
			|||||||
        createNewTopLevelNote,
 | 
					        createNewTopLevelNote,
 | 
				
			||||||
        createNote,
 | 
					        createNote,
 | 
				
			||||||
        setNoteBackgroundIfProtected,
 | 
					        setNoteBackgroundIfProtected,
 | 
				
			||||||
        setTreeBasedOnProtectedStatus,
 | 
					 | 
				
			||||||
        loadNoteToEditor,
 | 
					 | 
				
			||||||
        loadNote,
 | 
					        loadNote,
 | 
				
			||||||
        getCurrentNote,
 | 
					        getCurrentNote,
 | 
				
			||||||
        getCurrentNoteId,
 | 
					        getCurrentNoteId,
 | 
				
			||||||
 | 
				
			|||||||
@ -133,6 +133,12 @@ const protected_session = (function() {
 | 
				
			|||||||
        noteEditor.setNoteBackgroundIfProtected(note);
 | 
					        noteEditor.setNoteBackgroundIfProtected(note);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function touchProtectedSession() {
 | 
				
			||||||
 | 
					        if (isProtectedSessionAvailable()) {
 | 
				
			||||||
 | 
					            lastProtectedSessionOperationDate = new Date();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    passwordFormEl.submit(() => {
 | 
					    passwordFormEl.submit(() => {
 | 
				
			||||||
        setupProtectedSession();
 | 
					        setupProtectedSession();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -152,6 +158,7 @@ const protected_session = (function() {
 | 
				
			|||||||
        isProtectedSessionAvailable,
 | 
					        isProtectedSessionAvailable,
 | 
				
			||||||
        protectNoteAndSendToServer,
 | 
					        protectNoteAndSendToServer,
 | 
				
			||||||
        unprotectNoteAndSendToServer,
 | 
					        unprotectNoteAndSendToServer,
 | 
				
			||||||
        getProtectedSessionId
 | 
					        getProtectedSessionId,
 | 
				
			||||||
 | 
					        touchProtectedSession
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user