From e787b0a9406c2774e5e873592e64d57d43bd6c24 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Mon, 16 Jan 2023 12:37:30 +0100 Subject: [PATCH] Add edit `user_type` to user (#209) --- README.md | 2 +- src/components/users.js | 38 ++++++++++++++++++++++++++----------- src/i18n/de.js | 1 + src/i18n/en.js | 1 + src/synapse/dataProvider.js | 3 ++- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4b5ee45..fc3bc20 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This project is built using [react-admin](https://marmelab.com/react-admin/). ### Supported Synapse -It needs at least [Synapse](https://github.com/matrix-org/synapse) v1.42.0 for all functions to work as expected! +It needs at least [Synapse](https://github.com/matrix-org/synapse) v1.46.0 for all functions to work as expected! You get your server version with the request `/_synapse/admin/v1/server_version`. See also [Synapse version API](https://matrix-org.github.io/synapse/develop/admin_api/version_api.html). diff --git a/src/components/users.js b/src/components/users.js index b6d47dc..5c045fd 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -71,6 +71,16 @@ const useStyles = makeStyles({ }, }); +const choices_medium = [ + { id: "email", name: "resources.users.email" }, + { id: "msisdn", name: "resources.users.msisdn" }, +]; + +const choices_type = [ + { id: "bot", name: "bot" }, + { id: "support", name: "support" }, +]; + const date_format = { year: "numeric", month: "2-digit", @@ -276,15 +286,19 @@ export const UserCreate = props => ( autoComplete="new-password" validate={maxLength(512)} /> + @@ -315,6 +329,7 @@ const UserTitle = ({ record }) => { ); }; + export const UserEdit = props => { const classes = useStyles(); const translate = useTranslate(); @@ -333,6 +348,13 @@ export const UserEdit = props => { + { > - + diff --git a/src/i18n/de.js b/src/i18n/de.js index 29c4436..cdc28ec 100644 --- a/src/i18n/de.js +++ b/src/i18n/de.js @@ -121,6 +121,7 @@ const de = { creation_ts_ms: "Zeitpunkt der Erstellung", consent_version: "Zugestimmte Geschäftsbedingungen", auth_provider: "Provider", + user_type: "Benutzertyp", }, helper: { deactivate: diff --git a/src/i18n/en.js b/src/i18n/en.js index fb63005..ace1edd 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -120,6 +120,7 @@ const en = { creation_ts_ms: "Creation timestamp", consent_version: "Consent version", auth_provider: "Provider", + user_type: "User type", }, helper: { deactivate: "You must provide a password to re-activate an account.", diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index b80b075..31015ee 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -298,7 +298,8 @@ const resourceMap = { function filterNullValues(key, value) { // Filtering out null properties - if (value === null) { + // to reset user_type from user, it must be null + if (value === null && key !== "user_type") { return undefined; } return value;