You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Merge pull request #2058 from matrix-org/t3chguy/hide_logout_warning_whilst_logging_out
while logging out ignore `Session.logged_out` as it is intentional
This commit is contained in:
@@ -386,6 +386,8 @@ function _persistCredentialsToLocalStorage(credentials) {
|
|||||||
console.log(`Session persisted for ${credentials.userId}`);
|
console.log(`Session persisted for ${credentials.userId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _isLoggingOut = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the current session out and transitions to the logged-out state
|
* Logs the current session out and transitions to the logged-out state
|
||||||
*/
|
*/
|
||||||
@@ -405,6 +407,7 @@ export function logout() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isLoggingOut = true;
|
||||||
MatrixClientPeg.get().logout().then(onLoggedOut,
|
MatrixClientPeg.get().logout().then(onLoggedOut,
|
||||||
(err) => {
|
(err) => {
|
||||||
// Just throwing an error here is going to be very unhelpful
|
// Just throwing an error here is going to be very unhelpful
|
||||||
@@ -420,6 +423,10 @@ export function logout() {
|
|||||||
).done();
|
).done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isLoggingOut() {
|
||||||
|
return _isLoggingOut;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the matrix client and all other react-sdk services that
|
* Starts the matrix client and all other react-sdk services that
|
||||||
* listen for events while a session is logged in.
|
* listen for events while a session is logged in.
|
||||||
@@ -451,6 +458,7 @@ async function startMatrixClient() {
|
|||||||
* storage. Used after a session has been logged out.
|
* storage. Used after a session has been logged out.
|
||||||
*/
|
*/
|
||||||
export function onLoggedOut() {
|
export function onLoggedOut() {
|
||||||
|
_isLoggingOut = false;
|
||||||
stopMatrixClient();
|
stopMatrixClient();
|
||||||
_clearStorage().done();
|
_clearStorage().done();
|
||||||
dis.dispatch({action: 'on_logged_out'});
|
dis.dispatch({action: 'on_logged_out'});
|
||||||
|
|||||||
@@ -1262,6 +1262,7 @@ export default React.createClass({
|
|||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
cli.on('Session.logged_out', function(call) {
|
cli.on('Session.logged_out', function(call) {
|
||||||
|
if (Lifecycle.isLoggingOut()) return;
|
||||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||||
Modal.createTrackedDialog('Signed out', '', ErrorDialog, {
|
Modal.createTrackedDialog('Signed out', '', ErrorDialog, {
|
||||||
title: _t('Signed Out'),
|
title: _t('Signed Out'),
|
||||||
|
|||||||
Reference in New Issue
Block a user