Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add a confirmation modal before account deactivation #6107

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Spinner from "../../../elements/Spinner";
import {SettingLevel} from "../../../../../settings/SettingLevel";
import {UIFeature} from "../../../../../settings/UIFeature";
import {replaceableComponent} from "../../../../../utils/replaceableComponent";
import QuestionDialog from '../../../dialogs/QuestionDialog';

@replaceableComponent("views.settings.tabs.user.GeneralUserSettingsTab")
export default class GeneralUserSettingsTab extends React.Component {
Expand Down Expand Up @@ -236,7 +237,21 @@ export default class GeneralUserSettingsTab extends React.Component {
});
};

_onDeactivateClicked = () => {
_onDeactivateClicked = async () => {
const { finished } = Modal.createTrackedDialog("Warning", "", QuestionDialog, {
title: _t("Warning"),
description: <div>
<p>
{ _t(`Please note that this is a permanent action. Once you deactivate your account, your
account cannot be reactivated, and you won't be able to sign up again with the same user ID.`) }
</p>
</div>,
danger: true,
button: _t('I understand the risks and wish to continue'),
});
const [proceed] = await finished;
if (!proceed) return;

Modal.createTrackedDialog('Deactivate Account', '', DeactivateAccountDialog, {
onFinished: (success) => {
if (success) this.props.closeSettingsFn();
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,8 @@
"Failed to change password. Is your password correct?": "Failed to change password. Is your password correct?",
"Success": "Success",
"Your password was successfully changed. You will not receive push notifications on other sessions until you log back in to them": "Your password was successfully changed. You will not receive push notifications on other sessions until you log back in to them",
"Please note that this is a permanent action. Once you deactivate your account, your\n account cannot be reactivated, and you won't be able to sign up again with the same user ID.": "Please note that this is a permanent action. Once you deactivate your account, your\n account cannot be reactivated, and you won't be able to sign up again with the same user ID.",
"I understand the risks and wish to continue": "I understand the risks and wish to continue",
"Email addresses": "Email addresses",
"Phone numbers": "Phone numbers",
"Set a new account password...": "Set a new account password...",
Expand Down