mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
Merge pull request #2259 from matrix-org/t3chguy/account_deactivation_preferences
Remove temporary account_deactivation_preferences
This commit is contained in:
commit
31b7a0ddcb
@ -35,19 +35,10 @@ export default class DeactivateAccountDialog extends React.Component {
|
|||||||
this._onPasswordFieldChange = this._onPasswordFieldChange.bind(this);
|
this._onPasswordFieldChange = this._onPasswordFieldChange.bind(this);
|
||||||
this._onEraseFieldChange = this._onEraseFieldChange.bind(this);
|
this._onEraseFieldChange = this._onEraseFieldChange.bind(this);
|
||||||
|
|
||||||
const deactivationPreferences =
|
|
||||||
MatrixClientPeg.get().getAccountData('im.riot.account_deactivation_preferences');
|
|
||||||
|
|
||||||
const shouldErase = (
|
|
||||||
deactivationPreferences &&
|
|
||||||
deactivationPreferences.getContent() &&
|
|
||||||
deactivationPreferences.getContent().shouldErase
|
|
||||||
) || false;
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
confirmButtonEnabled: false,
|
confirmButtonEnabled: false,
|
||||||
busy: false,
|
busy: false,
|
||||||
shouldErase,
|
shouldErase: false,
|
||||||
errStr: null,
|
errStr: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -67,36 +58,6 @@ export default class DeactivateAccountDialog extends React.Component {
|
|||||||
async _onOk() {
|
async _onOk() {
|
||||||
this.setState({busy: true});
|
this.setState({busy: true});
|
||||||
|
|
||||||
// Before we deactivate the account insert an event into
|
|
||||||
// the user's account data indicating that they wish to be
|
|
||||||
// erased from the homeserver.
|
|
||||||
//
|
|
||||||
// We do this because the API for erasing after deactivation
|
|
||||||
// might not be supported by the connected homeserver. Leaving
|
|
||||||
// an indication in account data is only best-effort, and
|
|
||||||
// in the worse case, the HS maintainer would have to run a
|
|
||||||
// script to erase deactivated accounts that have shouldErase
|
|
||||||
// set to true in im.riot.account_deactivation_preferences.
|
|
||||||
//
|
|
||||||
// Note: The preferences are scoped to Riot, hence the
|
|
||||||
// "im.riot..." event type.
|
|
||||||
//
|
|
||||||
// Note: This may have already been set on previous attempts
|
|
||||||
// where, for example, the user entered the wrong password.
|
|
||||||
// This is fine because the UI always indicates the preference
|
|
||||||
// prior to us calling `deactivateAccount`.
|
|
||||||
try {
|
|
||||||
await MatrixClientPeg.get().setAccountData('im.riot.account_deactivation_preferences', {
|
|
||||||
shouldErase: this.state.shouldErase,
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
this.setState({
|
|
||||||
busy: false,
|
|
||||||
errStr: _t('Failed to indicate account erasure'),
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// This assumes that the HS requires password UI auth
|
// This assumes that the HS requires password UI auth
|
||||||
// for this endpoint. In reality it could be any UI auth.
|
// for this endpoint. In reality it could be any UI auth.
|
||||||
|
Loading…
Reference in New Issue
Block a user