From 733401652be5bb06affae6d5bd6cf3a2a4fc9ff7 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 11 Jul 2019 14:54:49 -0600 Subject: [PATCH] Close settings after deactivating Fixes https://github.com/vector-im/riot-web/issues/9566 --- .../views/dialogs/DeactivateAccountDialog.js | 2 +- src/components/views/dialogs/UserSettingsDialog.js | 2 +- .../settings/tabs/user/GeneralUserSettingsTab.js | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/DeactivateAccountDialog.js b/src/components/views/dialogs/DeactivateAccountDialog.js index cdb5950313..85b011688e 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.js +++ b/src/components/views/dialogs/DeactivateAccountDialog.js @@ -83,7 +83,7 @@ export default class DeactivateAccountDialog extends React.Component { Analytics.trackEvent('Account', 'Deactivate Account'); Lifecycle.onLoggedOut(); - this.props.onFinished(false); + this.props.onFinished(true); } _onCancel() { diff --git a/src/components/views/dialogs/UserSettingsDialog.js b/src/components/views/dialogs/UserSettingsDialog.js index a24c18c8b2..fb9045f05a 100644 --- a/src/components/views/dialogs/UserSettingsDialog.js +++ b/src/components/views/dialogs/UserSettingsDialog.js @@ -41,7 +41,7 @@ export default class UserSettingsDialog extends React.Component { tabs.push(new Tab( _td("General"), "mx_UserSettingsDialog_settingsIcon", - , + , )); tabs.push(new Tab( _td("Flair"), diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index 093160e330..06c012c91e 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -26,12 +26,17 @@ import SettingsStore from "../../../../../settings/SettingsStore"; import LanguageDropdown from "../../../elements/LanguageDropdown"; import AccessibleButton from "../../../elements/AccessibleButton"; import DeactivateAccountDialog from "../../../dialogs/DeactivateAccountDialog"; +import PropTypes from "prop-types"; const PlatformPeg = require("../../../../../PlatformPeg"); const sdk = require('../../../../..'); const Modal = require("../../../../../Modal"); const dis = require("../../../../../dispatcher"); export default class GeneralUserSettingsTab extends React.Component { + static propTypes = { + closeSettingsFn: PropTypes.func.isRequired, + }; + constructor() { super(); @@ -87,7 +92,11 @@ export default class GeneralUserSettingsTab extends React.Component { }; _onDeactivateClicked = () => { - Modal.createTrackedDialog('Deactivate Account', '', DeactivateAccountDialog, {}); + Modal.createTrackedDialog('Deactivate Account', '', DeactivateAccountDialog, { + onFinished: (success) => { + if (success) this.props.closeSettingsFn(); + }, + }); }; _renderProfileSection() {