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 1/4] 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; From e23e9ccd8213ef79319f0bb517feed8b1cb58621 Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Mon, 16 Jan 2023 12:52:00 +0100 Subject: [PATCH 2/4] Create `UserEditActions` on user page (#222) * Create `UserEditActions` on user page * Fix crash with crashes `undefined` --- src/components/users.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/users.js b/src/components/users.js index 5c045fd..29879e4 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -259,20 +259,31 @@ export function generateRandomUser() { }; } -const UserEditToolbar = props => { +const UserEditToolbar = props => ( + + + +); + +const UserEditActions = ({ data }) => { const translate = useTranslate(); + var userStatus = ""; + if (data) { + userStatus = data.deactivated; + } + return ( - - + + {!userStatus && } - - + ); }; @@ -334,7 +345,7 @@ export const UserEdit = props => { const classes = useStyles(); const translate = useTranslate(); return ( - }> + } actions={}> }> Date: Mon, 16 Jan 2023 12:53:38 +0100 Subject: [PATCH 3/4] Add some status badges to `README.md` (#291) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index fc3bc20..4322072 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ +[![GitHub license](https://img.shields.io/github/license/Awesome-Technologies/synapse-admin)](https://github.com/Awesome-Technologies/synapse-admin/blob/master/LICENSE) [![Build Status](https://travis-ci.org/Awesome-Technologies/synapse-admin.svg?branch=master)](https://travis-ci.org/Awesome-Technologies/synapse-admin) [![build-test](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml/badge.svg)](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml) +[![gh-pages](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/edge_ghpage.yml/badge.svg)](https://awesome-technologies.github.io/synapse-admin/) +[![docker-release](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/docker-release.yml/badge.svg)](https://hub.docker.com/r/awesometechnologies/synapse-admin) +[![github-release](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/github-release.yml/badge.svg)](https://github.com/Awesome-Technologies/synapse-admin/releases) # Synapse admin ui From 24afbd2953912440690ef7507fd8f66d4b396e70 Mon Sep 17 00:00:00 2001 From: Michael Albert Date: Mon, 16 Jan 2023 13:42:16 +0100 Subject: [PATCH 4/4] Fix build environment Change-Id: I1e32a0eeaaa0e6b8c8d4845183e7d37320a4eeae --- .prettierrc | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.prettierrc b/.prettierrc index 6b2571e..21c6d0f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,6 +6,6 @@ "singleQuote": false, "trailingComma": "es5", "bracketSpacing": true, - "jsxBracketSameLine": false, + "bracketSameLine": false, "arrowParens": "avoid" } diff --git a/.travis.yml b/.travis.yml index 38d82bd..37c5de1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - lts/* + - 17 cache: yarn