From b184954ffa179fbe4fbdc2a75010361c3fe0edeb Mon Sep 17 00:00:00 2001
From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com>
Date: Thu, 11 Feb 2021 20:20:42 +0100
Subject: [PATCH 1/4] Update `total` in dataProvider (#101)
---
src/synapse/dataProvider.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js
index 560bdb9..3df3c9d 100644
--- a/src/synapse/dataProvider.js
+++ b/src/synapse/dataProvider.js
@@ -87,7 +87,9 @@ const resourceMap = {
id: d.device_id,
}),
data: "devices",
- total: json => json.devices.length,
+ total: json => {
+ return json.total;
+ },
reference: id => ({
endpoint: `/_synapse/admin/v2/users/${id}/devices`,
}),
@@ -111,7 +113,9 @@ const resourceMap = {
endpoint: `/_synapse/admin/v1/rooms/${id}/members`,
}),
data: "members",
- total: json => json.members.length,
+ total: json => {
+ return json.total;
+ },
},
servernotices: {
map: n => ({ id: n.event_id }),
From 425c210cfc632260468e7ec21db2334e470afe34 Mon Sep 17 00:00:00 2001
From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com>
Date: Thu, 11 Feb 2021 20:24:17 +0100
Subject: [PATCH 2/4] Add delete button to room detail page (#97)
* Add delete button to room detail page
* Add confirmation dialog for room deletion
---
src/components/rooms.js | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/components/rooms.js b/src/components/rooms.js
index 041f0a6..efef5cb 100644
--- a/src/components/rooms.js
+++ b/src/components/rooms.js
@@ -4,6 +4,7 @@ import {
BooleanField,
BulkDeleteWithConfirmButton,
Datagrid,
+ DeleteButton,
Filter,
List,
Pagination,
@@ -15,6 +16,7 @@ import {
Tab,
TabbedShowLayout,
TextField,
+ TopToolbar,
useTranslate,
} from "react-admin";
import get from "lodash/get";
@@ -70,10 +72,26 @@ const RoomTitle = ({ record }) => {
);
};
+const RoomShowActions = ({ basePath, data, resource }) => {
+ const translate = useTranslate();
+ return (
+
+
+
+ );
+};
+
export const RoomShow = props => {
const translate = useTranslate();
return (
- }>
+ } title={}>
}>
From f2a12756733964da59069a1cd9a63b3f1e1a4407 Mon Sep 17 00:00:00 2001
From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com>
Date: Thu, 11 Feb 2021 20:37:20 +0100
Subject: [PATCH 3/4] Add a new tab to user page with pushers (#85)
* Add a new tab to user page with pushers
* Update pushers `total` and `id`
---
src/App.js | 1 +
src/components/users.js | 27 +++++++++++++++++++++++++++
src/i18n/de.js | 14 ++++++++++++++
src/i18n/en.js | 14 ++++++++++++++
src/synapse/dataProvider.js | 13 +++++++++++++
5 files changed, 69 insertions(+)
diff --git a/src/App.js b/src/App.js
index 5b784c4..e9378b8 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 5f8caf8..d463379 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 NotificationsIcon from "@material-ui/icons/Notifications";
import {
ArrayInput,
ArrayField,
@@ -312,6 +313,7 @@ export const UserEdit = props => {
/>
+
}
@@ -330,6 +332,7 @@ export const UserEdit = props => {
+
}
@@ -361,6 +364,7 @@ export const UserEdit = props => {
+
}
@@ -400,6 +404,29 @@ export const UserEdit = props => {
+
+ }
+ path="pushers"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
);
diff --git a/src/i18n/de.js b/src/i18n/de.js
index 1b60545..a881b1d 100644
--- a/src/i18n/de.js
+++ b/src/i18n/de.js
@@ -223,6 +223,20 @@ export default {
},
},
},
+ pushers: {
+ name: "Pusher |||| Pushers",
+ fields: {
+ app: "App",
+ app_display_name: "App-Anzeigename",
+ app_id: "App ID",
+ device_display_name: "Geräte-Anzeigename",
+ kind: "Art",
+ lang: "Sprache",
+ profile_tag: "Profil-Tag",
+ pushkey: "Pushkey",
+ data: { url: "URL" },
+ },
+ },
servernotices: {
name: "Serverbenachrichtigungen",
send: "Servernachricht versenden",
diff --git a/src/i18n/en.js b/src/i18n/en.js
index 76b33aa..87d70be 100644
--- a/src/i18n/en.js
+++ b/src/i18n/en.js
@@ -220,6 +220,20 @@ export default {
},
},
},
+ pushers: {
+ name: "Pusher |||| Pushers",
+ fields: {
+ app: "App",
+ app_display_name: "App display name",
+ app_id: "App ID",
+ device_display_name: "Device display name",
+ kind: "Kind",
+ lang: "Language",
+ profile_tag: "Profile tag",
+ pushkey: "Pushkey",
+ data: { url: "URL" },
+ },
+ },
servernotices: {
name: "Server Notices",
send: "Send server notices",
diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js
index 3df3c9d..815d5dd 100644
--- a/src/synapse/dataProvider.js
+++ b/src/synapse/dataProvider.js
@@ -117,6 +117,19 @@ const resourceMap = {
return json.total;
},
},
+ pushers: {
+ map: p => ({
+ ...p,
+ id: p.pushkey,
+ }),
+ reference: id => ({
+ endpoint: `/_synapse/admin/v1/users/${id}/pushers`,
+ }),
+ data: "pushers",
+ total: json => {
+ return json.total;
+ },
+ },
servernotices: {
map: n => ({ id: n.event_id }),
create: data => ({
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 4/4] 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 => ({