Adapt for changes in v2/users API
Change-Id: I927b81882fa20e5b3de3d9fc216e2136f7036bba
This commit is contained in:
@@ -25,11 +25,7 @@ const resourceMap = {
|
||||
deactivated: !!u.deactivated,
|
||||
}),
|
||||
data: "users",
|
||||
total: (json, from, perPage) => {
|
||||
return json.next_token
|
||||
? parseInt(json.next_token, 10) + perPage
|
||||
: from + json.users.length;
|
||||
},
|
||||
total: json => json.total,
|
||||
delete: id => ({
|
||||
endpoint: `/_synapse/admin/v1/deactivate/${id}`,
|
||||
body: { erase: true },
|
||||
@@ -96,25 +92,6 @@ const dataProvider = {
|
||||
const homeserver_url = homeserver + res.path;
|
||||
const url = `${homeserver_url}?${stringify(query)}`;
|
||||
|
||||
// searching for users is not implemented in admin api
|
||||
if (params.filter.q) {
|
||||
console.log("searching");
|
||||
const search_query = { limit: perPage, search_term: params.filter.q };
|
||||
const search_url =
|
||||
homeserver + `/_matrix/client/r0/user_directory/search`;
|
||||
return jsonClient(search_url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(search_query),
|
||||
}).then(({ json }) => ({
|
||||
data: json["results"].map(u => ({
|
||||
...u,
|
||||
id: u.user_id,
|
||||
name: u.user_id,
|
||||
})),
|
||||
total: json.limited ? perPage * 2 : json.results.length,
|
||||
}));
|
||||
}
|
||||
|
||||
return jsonClient(url).then(({ json }) => ({
|
||||
data: json[res.data].map(res.map),
|
||||
total: res.total(json, from, perPage),
|
||||
|
||||
Reference in New Issue
Block a user