You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
(Breaking Change) Add erase option to deactivateAccount (#649)
For erasing messages etc. after deactivation. **Breaking change: `deactivateAccount` no longer takes callback** Also: Move /account/deactivate from PREFIX_UNSTABLE to _R0
This commit is contained in:
@@ -338,18 +338,29 @@ MatrixBaseApis.prototype.logout = function(callback) {
|
|||||||
* it is up to the caller to either reset or destroy the MatrixClient after
|
* it is up to the caller to either reset or destroy the MatrixClient after
|
||||||
* this method succeeds.
|
* this method succeeds.
|
||||||
* @param {object} auth Optional. Auth data to supply for User-Interactive auth.
|
* @param {object} auth Optional. Auth data to supply for User-Interactive auth.
|
||||||
* @param {module:client.callback} callback Optional.
|
* @param {boolean} erase Optional. If set, send as `erase` attribute in the
|
||||||
|
* JSON request body, indicating whether the account should be erased. Defaults
|
||||||
|
* to false.
|
||||||
* @return {module:client.Promise} Resolves: On success, the empty object
|
* @return {module:client.Promise} Resolves: On success, the empty object
|
||||||
*/
|
*/
|
||||||
MatrixBaseApis.prototype.deactivateAccount = function(auth, callback) {
|
MatrixBaseApis.prototype.deactivateAccount = function(auth, erase) {
|
||||||
let body = {};
|
if (typeof(erase) === 'function') {
|
||||||
if (auth) {
|
throw new Error(
|
||||||
body = {
|
'deactivateAccount no longer accepts a callback parameter',
|
||||||
auth: auth,
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const body = {};
|
||||||
|
if (auth) {
|
||||||
|
body.auth = auth;
|
||||||
|
}
|
||||||
|
if (erase !== undefined) {
|
||||||
|
body.erase = erase;
|
||||||
|
}
|
||||||
|
|
||||||
return this._http.authedRequestWithPrefix(
|
return this._http.authedRequestWithPrefix(
|
||||||
callback, "POST", '/account/deactivate', undefined, body, httpApi.PREFIX_UNSTABLE,
|
undefined, "POST", '/account/deactivate', undefined, body,
|
||||||
|
httpApi.PREFIX_R0,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user