diff --git a/Dockerfile b/Dockerfile index be60bfd..92ce546 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Builder -FROM node:current as builder +FROM node:lts as builder WORKDIR /src diff --git a/README.md b/README.md index 60fc727..1c4483c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This project is built using [react-admin](https://marmelab.com/react-admin/). + It needs at least Synapse v1.42.0 for all functions to work as expected! You get your server version with the request `/_synapse/admin/v1/server_version`. diff --git a/src/components/RoomDirectory.js b/src/components/RoomDirectory.js index d8d0469..0284e14 100644 --- a/src/components/RoomDirectory.js +++ b/src/components/RoomDirectory.js @@ -59,7 +59,7 @@ export const RoomDirectoryBulkDeleteButton = props => ( } perPage={100} > - + "/rooms/" + id + "/show"}> { const ServerNoticeToolbar = props => ( - + diff --git a/src/components/rooms.js b/src/components/rooms.js index d91db05..fa01c77 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -315,7 +315,7 @@ const RoomBulkActionButtons = props => ( {...props} confirmTitle="resources.rooms.action.erase.title" confirmContent="resources.rooms.action.erase.content" - undoable={false} + mutationMode="pessimistic" /> ); diff --git a/src/components/users.js b/src/components/users.js index c954416..ff29fdf 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -36,7 +36,9 @@ import { BulkDeleteButton, DeleteButton, SaveButton, + maxLength, regex, + required, useTranslate, Pagination, CreateButton, @@ -142,7 +144,7 @@ const UserBulkActionButtons = props => ( {...props} label="resources.users.action.erase" confirmTitle="resources.users.helper.erase" - undoable={false} + mutationMode="pessimistic" /> ); @@ -180,10 +182,16 @@ export const UserList = props => { }; // https://matrix.org/docs/spec/appendices#user-identifiers -const validateUser = regex( - /^@[a-z0-9._=\-/]+:.*/, - "synapseadmin.users.invalid_user_id" -); +// here only local part of user_id +// maxLength = 255 - "@" - ":" - localStorage.getItem("home_server").length +// localStorage.getItem("home_server").length is not valid here +const validateUser = [ + required(), + maxLength(253), + regex(/^[a-z0-9._=\-/]+$/, "synapseadmin.users.invalid_user_id"), +]; + +const validateAddress = [required(), maxLength(255)]; export function generateRandomUser() { const homeserver = localStorage.getItem("home_server"); @@ -230,7 +238,7 @@ const UserEditToolbar = props => { const translate = useTranslate(); return ( - + ( - - + + @@ -258,8 +270,19 @@ export const UserCreate = props => ( { id: "email", name: "resources.users.email" }, { id: "msisdn", name: "resources.users.msisdn" }, ]} + validate={required()} + /> + + + + + + + - @@ -339,16 +362,16 @@ export const UserEdit = props => { icon={} path="sso" > - - - - + + + - - + + json.total, create: data => ({ - endpoint: `/_synapse/admin/v2/users/${data.id}`, + endpoint: `/_synapse/admin/v2/users/@${data.id}:${localStorage.getItem( + "home_server" + )}`, body: data, method: "PUT", }), diff --git a/yarn.lock b/yarn.lock index 66c1d5b..532abd7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7729,9 +7729,9 @@ minipass-pipeline@^1.2.2: minipass "^3.0.0" minipass@^3.0.0, minipass@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd" - integrity sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== + version "3.1.5" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.5.tgz#71f6251b0a33a49c01b3cf97ff77eda030dff732" + integrity sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw== dependencies: yallist "^4.0.0" @@ -11077,9 +11077,9 @@ tapable@^1.0.0, tapable@^1.1.3: integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== tar@^6.0.2: - version "6.1.8" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.8.tgz#4fc50cfe56511c538ce15b71e05eebe66530cbd4" - integrity sha512-sb9b0cp855NbkMJcskdSYA7b11Q8JsX4qe4pyUAfHp+Y6jBjJeek2ZVlwEfWayshEIwlIzXx0Fain3QG9JPm2A== + version "6.1.11" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" + integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== dependencies: chownr "^2.0.0" fs-minipass "^2.0.0" @@ -11213,9 +11213,9 @@ tiny-warning@^1.0.0, tiny-warning@^1.0.2, tiny-warning@^1.0.3: integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-arraybuffer@^1.0.0: version "1.0.1"