mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	more robust entering protected session and the following protection of a note
This commit is contained in:
		| @@ -94,12 +94,6 @@ class AppContext extends Component { | |||||||
|     getComponentByEl(el) { |     getComponentByEl(el) { | ||||||
|         return $(el).closest(".component").prop('component'); |         return $(el).closest(".component").prop('component'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async protectedSessionStartedEvent() { |  | ||||||
|         await treeCache.loadInitialTree(); |  | ||||||
|  |  | ||||||
|         this.triggerEvent('treeCacheReloaded'); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| const appContext = new AppContext(); | const appContext = new AppContext(); | ||||||
|   | |||||||
| @@ -1,13 +1,10 @@ | |||||||
| import treeService from './tree.js'; |  | ||||||
| import utils from './utils.js'; | import utils from './utils.js'; | ||||||
| import server from './server.js'; | import server from './server.js'; | ||||||
| import protectedSessionHolder from './protected_session_holder.js'; | import protectedSessionHolder from './protected_session_holder.js'; | ||||||
| import toastService from "./toast.js"; | import toastService from "./toast.js"; | ||||||
| import ws from "./ws.js"; | import ws from "./ws.js"; | ||||||
| import appContext from "./app_context.js"; | import appContext from "./app_context.js"; | ||||||
|  | import treeCache from "./tree_cache.js"; | ||||||
| const $enterProtectedSessionButton = $("#enter-protected-session-button"); |  | ||||||
| const $leaveProtectedSessionButton = $("#leave-protected-session-button"); |  | ||||||
|  |  | ||||||
| let protectedSessionDeferred = null; | let protectedSessionDeferred = null; | ||||||
|  |  | ||||||
| @@ -45,6 +42,10 @@ async function setupProtectedSession(password) { | |||||||
|     protectedSessionHolder.setProtectedSessionId(response.protectedSessionId); |     protectedSessionHolder.setProtectedSessionId(response.protectedSessionId); | ||||||
|     protectedSessionHolder.touchProtectedSession(); |     protectedSessionHolder.touchProtectedSession(); | ||||||
|  |  | ||||||
|  |     await treeCache.loadInitialTree(); | ||||||
|  |  | ||||||
|  |     await appContext.triggerEvent('treeCacheReloaded'); | ||||||
|  |  | ||||||
|     appContext.triggerEvent('protectedSessionStarted'); |     appContext.triggerEvent('protectedSessionStarted'); | ||||||
|  |  | ||||||
|     if (protectedSessionDeferred !== null) { |     if (protectedSessionDeferred !== null) { | ||||||
| @@ -54,9 +55,6 @@ async function setupProtectedSession(password) { | |||||||
|         protectedSessionDeferred = null; |         protectedSessionDeferred = null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $enterProtectedSessionButton.hide(); |  | ||||||
|     $leaveProtectedSessionButton.show(); |  | ||||||
|  |  | ||||||
|     toastService.showMessage("Protected session has been started."); |     toastService.showMessage("Protected session has been started."); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user