Step 8.5: Move logout call during deactivation
This commit is contained in:
parent
bcf413734b
commit
c8582c7199
3 changed files with 20 additions and 2 deletions
|
@ -60,10 +60,18 @@ import StorageEvictedDialog from "./components/views/dialogs/StorageEvictedDialo
|
|||
import { setSentryUser } from "./sentry";
|
||||
import SdkConfig from "./SdkConfig";
|
||||
import { DialogOpener } from "./utils/DialogOpener";
|
||||
import { Action } from "./dispatcher/actions";
|
||||
|
||||
const HOMESERVER_URL_KEY = "mx_hs_url";
|
||||
const ID_SERVER_URL_KEY = "mx_is_url";
|
||||
|
||||
dis.register((payload) => {
|
||||
if (payload.action === Action.TriggerLogout) {
|
||||
// noinspection JSIgnoredPromiseFromCall - we don't care if it fails
|
||||
onLoggedOut();
|
||||
}
|
||||
});
|
||||
|
||||
interface ILoadSessionOpts {
|
||||
enableGuest?: boolean;
|
||||
guestHsUrl?: string;
|
||||
|
|
|
@ -21,12 +21,13 @@ import { logger } from "matrix-js-sdk/src/logger";
|
|||
|
||||
import Analytics from '../../../Analytics';
|
||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||
import * as Lifecycle from '../../../Lifecycle';
|
||||
import { _t } from '../../../languageHandler';
|
||||
import InteractiveAuth, { ERROR_USER_CANCELLED } from "../../structures/InteractiveAuth";
|
||||
import { DEFAULT_PHASE, PasswordAuthEntry, SSOAuthEntry } from "../auth/InteractiveAuthEntryComponents";
|
||||
import StyledCheckbox from "../elements/StyledCheckbox";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import defaultDispatcher from "../../../dispatcher/dispatcher";
|
||||
import { Action } from "../../../dispatcher/actions";
|
||||
|
||||
interface IProps {
|
||||
onFinished: (success: boolean) => void;
|
||||
|
@ -122,7 +123,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
|
|||
MatrixClientPeg.get().deactivateAccount(auth, this.state.shouldErase).then(r => {
|
||||
// Deactivation worked - logout & close this dialog
|
||||
Analytics.trackEvent('Account', 'Deactivate Account');
|
||||
Lifecycle.onLoggedOut();
|
||||
defaultDispatcher.fire(Action.TriggerLogout);
|
||||
this.props.onFinished(true);
|
||||
}).catch(e => {
|
||||
logger.error(e);
|
||||
|
|
|
@ -283,4 +283,13 @@ export enum Action {
|
|||
* Payload: OpenTabbedIntegrationManagerDialogPayload
|
||||
*/
|
||||
OpenTabbedIntegrationManagerDialog = "open_tabbed_imanager_dialog",
|
||||
|
||||
/**
|
||||
* Fired when something within the application has determined that a logout,
|
||||
* or logout-like behaviour, needs to happen. Specifically meant to target
|
||||
* storage deletion rather than calling the logout API.
|
||||
*
|
||||
* No payload.
|
||||
*/
|
||||
TriggerLogout = "trigger_logout",
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue