From 706114a3829654802d2776903ed0f17e16104ba4 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:45:02 +0100 Subject: [PATCH] Add a new tab to user page with room memberships (#73) The admin API for user's room memberships is new in synapse v1.21.0. Co-authored-by: Michael Albert <37796947+awesome-michael@users.noreply.github.com> --- src/App.js | 1 + src/components/users.js | 33 +++++++++++++++++++++++++++++++++ src/synapse/dataProvider.js | 12 ++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/App.js b/src/App.js index e9378b8..5c8e132 100644 --- a/src/App.js +++ b/src/App.js @@ -52,6 +52,7 @@ const App = () => ( + diff --git a/src/components/users.js b/src/components/users.js index d463379..e93e409 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -5,6 +5,7 @@ import ContactMailIcon from "@material-ui/icons/ContactMail"; import DevicesIcon from "@material-ui/icons/Devices"; import GetAppIcon from "@material-ui/icons/GetApp"; import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; +import ViewListIcon from "@material-ui/icons/ViewList"; import NotificationsIcon from "@material-ui/icons/Notifications"; import { ArrayInput, @@ -405,6 +406,38 @@ export const UserEdit = props => { + } + path="rooms" + > + + "/rooms/" + id + "/show"} + > + + + + + + + + } diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 815d5dd..a329e66 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -130,6 +130,18 @@ const resourceMap = { return json.total; }, }, + joined_rooms: { + map: jr => ({ + id: jr, + }), + reference: id => ({ + endpoint: `/_synapse/admin/v1/users/${id}/joined_rooms`, + }), + data: "joined_rooms", + total: json => { + return json.total; + }, + }, servernotices: { map: n => ({ id: n.event_id }), create: data => ({