diff --git a/src/components/users.js b/src/components/users.js index 8ee8ea7..efc54ac 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -39,7 +39,7 @@ const UserPagination = props => ( const UserFilter = props => ( - + ( pagination={} > - - - - - {/* Hack since the users endpoint does not give displaynames in the list*/} - - - + + + diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 24e114b..3eb84e8 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -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),