Add support to remove user devices (#57)
Change-Id: I19176daa656b9280ccd00f1ca0095e72870ca21e
This commit is contained in:
@@ -45,8 +45,8 @@ const resourceMap = {
|
||||
body: data,
|
||||
method: "PUT",
|
||||
}),
|
||||
delete: id => ({
|
||||
endpoint: `/_synapse/admin/v1/deactivate/${id}`,
|
||||
delete: params => ({
|
||||
endpoint: `/_synapse/admin/v1/deactivate/${params.id}`,
|
||||
body: { erase: true },
|
||||
method: "POST",
|
||||
}),
|
||||
@@ -76,6 +76,9 @@ const resourceMap = {
|
||||
reference: id => ({
|
||||
endpoint: `/_synapse/admin/v2/users/${id}/devices`,
|
||||
}),
|
||||
delete: params => ({
|
||||
endpoint: `/_synapse/admin/v2/users/${params.user_id}/devices/${params.id}`,
|
||||
}),
|
||||
},
|
||||
connections: {
|
||||
path: "/_synapse/admin/v1/whois",
|
||||
@@ -274,11 +277,11 @@ const dataProvider = {
|
||||
const res = resourceMap[resource];
|
||||
|
||||
if ("delete" in res) {
|
||||
const del = res["delete"](params.id);
|
||||
const del = res["delete"](params);
|
||||
const endpoint_url = homeserver + del.endpoint;
|
||||
return jsonClient(endpoint_url, {
|
||||
method: del.method,
|
||||
body: JSON.stringify(del.body),
|
||||
method: "method" in del ? del.method : "DELETE",
|
||||
body: "body" in del ? JSON.stringify(del.body) : null,
|
||||
}).then(({ json }) => ({
|
||||
data: json,
|
||||
}));
|
||||
@@ -303,11 +306,11 @@ const dataProvider = {
|
||||
if ("delete" in res) {
|
||||
return Promise.all(
|
||||
params.ids.map(id => {
|
||||
const del = res["delete"](id);
|
||||
const del = res["delete"]({ ...params, id: id });
|
||||
const endpoint_url = homeserver + del.endpoint;
|
||||
return jsonClient(endpoint_url, {
|
||||
method: del.method,
|
||||
body: JSON.stringify(del.body),
|
||||
method: "method" in del ? del.method : "DELETE",
|
||||
body: "body" in del ? JSON.stringify(del.body) : null,
|
||||
});
|
||||
})
|
||||
).then(responses => ({
|
||||
|
||||
Reference in New Issue
Block a user