From 2163c4dfc8f82322a15b189f87b71de42f8dd98b Mon Sep 17 00:00:00 2001 From: Michael Albert Date: Mon, 10 Feb 2020 18:06:05 +0100 Subject: [PATCH 1/4] Fix user create/update url Change-Id: I33ff191f7e598c29e0b034d5079e9adf05ff80ae --- src/synapse/dataProvider.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 441f813..50247d8 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -142,11 +142,11 @@ const dataProvider = { const res = resourceMap[resource]; const homeserver_url = "https://" + homeserver + res.path; - return jsonClient(`${homeserver_url}/${params.id}`, { + return jsonClient(`${homeserver_url}/${params.data.id}`, { method: "PUT", body: JSON.stringify(params.data, filterNullValues), }).then(({ json }) => ({ - data: json, + data: res.map(json), })); }, @@ -174,14 +174,11 @@ const dataProvider = { const res = resourceMap[resource]; const homeserver_url = "https://" + homeserver + res.path; - return jsonClient(`${homeserver_url}/${params.id}`, { + return jsonClient(`${homeserver_url}/${params.data.id}`, { method: "PUT", body: JSON.stringify(params.data, filterNullValues), }).then(({ json }) => ({ - data: { - ...params.data, - id: json.id, - }, + data: res.map(json), })); }, From 726461aa19b1ae8af7ec02efc594a7ff74025b16 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Mon, 10 Feb 2020 19:20:20 +0100 Subject: [PATCH 2/4] Fix deleteMany() in dataProvider (#6) Change-Id: I6ef3abbf3ed7a1860b7c395d91fda8b7e44f4d95 --- src/synapse/dataProvider.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/synapse/dataProvider.js b/src/synapse/dataProvider.js index 50247d8..45ffc3f 100644 --- a/src/synapse/dataProvider.js +++ b/src/synapse/dataProvider.js @@ -204,13 +204,15 @@ const dataProvider = { const res = resourceMap[resource]; const homeserver_url = "https://" + homeserver + res.path; return Promise.all( - params.ids.map(id => jsonClient(`${homeserver_url}/${id}`), { - method: "DELETE", - body: JSON.stringify(params.data, filterNullValues), - }) - ).then(responses => ({ - data: responses.map(({ json }) => json), - })); + params.ids.map(id => + jsonClient(`${homeserver_url}/${id}`, { + method: "DELETE", + body: JSON.stringify(params.data, filterNullValues), + }).then(responses => ({ + data: responses.map(({ json }) => json), + })) + ) + ); }, }; From 769159249f68cf2598b9131f31b4e8eac1519f3c Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Tue, 11 Feb 2020 09:41:35 +0100 Subject: [PATCH 3/4] Add travis-ci integration Change-Id: I2c2966c2fde44ab7eccc20eed983153dc753a2f4 --- .travis.yml | 5 +++++ README.md | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9f0988f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 13 + +cache: yarn diff --git a/README.md b/README.md index 66bfd4f..903f4f1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/Awesome-Technologies/synapse-admin.svg?branch=master)](https://travis-ci.org/Awesome-Technologies/synapse-admin) + # Synapse admin ui This project is built using [react-admin](https://marmelab.com/react-admin/). From 765aa66188a75aabcb2fb325e79a2f2d2af48c70 Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Tue, 11 Feb 2020 10:51:16 +0100 Subject: [PATCH 4/4] Add eslint integration See https://github.com/lipis/prettier-setup Change-Id: I5479e2502cdab35addfe38f889801e7d4f21fb42 --- package.json | 12 +++++++++++- yarn.lock | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a167252..d15cdb9 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "@testing-library/user-event": "^8.1.0", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.2", + "eslint": "^6.8.0", + "eslint-config-prettier": "^6.10.0", + "eslint-plugin-prettier": "^3.1.2", "prettier": "^1.19.1" }, "dependencies": { @@ -27,7 +30,14 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "test": "react-scripts test", + "fix:other": "yarn prettier --write", + "fix:code": "yarn test:lint --fix", + "fix": "yarn fix:code && yarn fix:other", + "prettier": "prettier \"**/*.{json,md,scss,yaml,yml}\"", + "test:code": "react-scripts test", + "test:lint": "eslint --ignore-path .gitignore --ext .js,.jsx .", + "test:style": "yarn prettier --list-different", + "test": "yarn test:style && yarn test:lint && yarn test:code", "eject": "react-scripts eject" }, "eslintConfig": { diff --git a/yarn.lock b/yarn.lock index c1a23ab..dbe755e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4159,6 +4159,13 @@ escodegen@^1.11.0, escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" +eslint-config-prettier@^6.10.0: + version "6.10.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.0.tgz#7b15e303bf9c956875c948f6b21500e48ded6a7f" + integrity sha512-AtndijGte1rPILInUdHjvKEGbIV06NuvPrqlIEaEaWtbtvJh464mDeyGMdZEQMsGvC0ZVkiex1fSNcC4HAbRGg== + dependencies: + get-stdin "^6.0.0" + eslint-config-react-app@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-5.2.0.tgz#135110ba56a9e378f7acfe5f36e2ae76a2317899" @@ -4233,6 +4240,13 @@ eslint-plugin-jsx-a11y@6.2.3: has "^1.0.3" jsx-ast-utils "^2.2.1" +eslint-plugin-prettier@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba" + integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-plugin-react-hooks@^1.6.1: version "1.7.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz#6210b6d5a37205f0b92858f895a4e827020a7d04" @@ -4281,7 +4295,7 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^6.6.0: +eslint@^6.6.0, eslint@^6.8.0: version "6.8.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== @@ -4546,6 +4560,11 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-glob@^2.0.2: version "2.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" @@ -4962,6 +4981,11 @@ get-own-enumerable-property-symbols@^3.0.0: resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664" integrity sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g== +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -8725,6 +8749,13 @@ prepend-http@^1.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + prettier@^1.19.1: version "1.19.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"