while logging out ignore `Session.logged_out` as it is intentional
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
							parent
							
								
									f429ae5617
								
							
						
					
					
						commit
						ffe0b35504
					
				|  | @ -385,6 +385,8 @@ function _persistCredentialsToLocalStorage(credentials) { | |||
|     console.log(`Session persisted for ${credentials.userId}`); | ||||
| } | ||||
| 
 | ||||
| let _isLoggingOut = false; | ||||
| 
 | ||||
| /** | ||||
|  * Logs the current session out and transitions to the logged-out state | ||||
|  */ | ||||
|  | @ -404,6 +406,7 @@ export function logout() { | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     _isLoggingOut = true; | ||||
|     MatrixClientPeg.get().logout().then(onLoggedOut, | ||||
|         (err) => { | ||||
|             // Just throwing an error here is going to be very unhelpful
 | ||||
|  | @ -419,6 +422,10 @@ export function logout() { | |||
|     ).done(); | ||||
| } | ||||
| 
 | ||||
| export function isLoggingOut() { | ||||
|     return _isLoggingOut; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Starts the matrix client and all other react-sdk services that | ||||
|  * listen for events while a session is logged in. | ||||
|  | @ -449,6 +456,7 @@ async function startMatrixClient() { | |||
|  * storage. Used after a session has been logged out. | ||||
|  */ | ||||
| export function onLoggedOut() { | ||||
|     _isLoggingOut = false; | ||||
|     stopMatrixClient(); | ||||
|     _clearStorage().done(); | ||||
|     dis.dispatch({action: 'on_logged_out'}); | ||||
|  |  | |||
|  | @ -1262,6 +1262,7 @@ export default React.createClass({ | |||
|             }, true); | ||||
|         }); | ||||
|         cli.on('Session.logged_out', function(call) { | ||||
|             if (Lifecycle.isLoggingOut()) return; | ||||
|             const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); | ||||
|             Modal.createTrackedDialog('Signed out', '', ErrorDialog, { | ||||
|                 title: _t('Signed Out'), | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Michael Telatynski
						Michael Telatynski