From 35853c049edb1c594ae3fe188e781ed0e6aec07e Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 14:35:58 +0200
Subject: [PATCH 01/28] prettier setting frontend
---
webapp/.eslintrc.js | 4 +++-
webapp/.prettierrc | 6 ------
webapp/.prettierrc.js | 9 +++++++++
3 files changed, 12 insertions(+), 7 deletions(-)
delete mode 100644 webapp/.prettierrc
create mode 100644 webapp/.prettierrc.js
diff --git a/webapp/.eslintrc.js b/webapp/.eslintrc.js
index fdc9bfb5e..f95b5c186 100644
--- a/webapp/.eslintrc.js
+++ b/webapp/.eslintrc.js
@@ -20,6 +20,8 @@ module.exports = {
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
- 'vue/component-name-in-template-casing': ['error', 'kebab-case']
+ 'vue/component-name-in-template-casing': ['error', 'kebab-case'],
+ 'prettier/prettier': ['error'],
+ // 'newline-per-chained-call': [2]
}
}
diff --git a/webapp/.prettierrc b/webapp/.prettierrc
deleted file mode 100644
index 7dc4f8263..000000000
--- a/webapp/.prettierrc
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "semi": false,
- "singleQuote": true,
- "tabWidth": 2,
- "bracketSpacing": true
-}
diff --git a/webapp/.prettierrc.js b/webapp/.prettierrc.js
new file mode 100644
index 000000000..e2cf91e91
--- /dev/null
+++ b/webapp/.prettierrc.js
@@ -0,0 +1,9 @@
+
+module.exports = {
+ semi: false,
+ printWidth: 100,
+ singleQuote: true,
+ trailingComma: "all",
+ tabWidth: 2,
+ bracketSpacing: true
+};
From eb6a9b30346039c411faca140dbb0ea04b6aa592 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 14:36:35 +0200
Subject: [PATCH 02/28] added vscode settings to project, removed ignore from
gitignore for .vscode folder
---
.gitignore | 1 -
.vscode/settings.json | 12 ++++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 .vscode/settings.json
diff --git a/.gitignore b/.gitignore
index 07623b965..eb661fd6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
.env
.idea
*.iml
-.vscode
.DS_Store
npm-debug.log*
yarn-debug.log*
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..9acbf50bd
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,12 @@
+{
+ "eslint.validate": [
+ "javascript",
+ "javascriptreact",
+ {
+ "language": "vue",
+ "autoFix": true
+ }
+ ],
+ "editor.formatOnSave": false,
+ "eslint.autoFixOnSave": true
+}
\ No newline at end of file
From 1351f1cee91592cf18f2446a246b8968157ee0d7 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 14:37:35 +0200
Subject: [PATCH 03/28] adjusted vscode settings
---
.vscode/settings.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 9acbf50bd..908252f41 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -7,6 +7,6 @@
"autoFix": true
}
],
- "editor.formatOnSave": false,
+ "editor.formatOnSave": true,
"eslint.autoFixOnSave": true
}
\ No newline at end of file
From 9dda50cfd88f848d7a87e76a1840ef762196b0a5 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 14:41:32 +0200
Subject: [PATCH 04/28] define vscode extension recommendations
---
.vscode/extensions.json | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 .vscode/extensions.json
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 000000000..e2d92ff83
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,7 @@
+{
+ "recommendations": [
+ "dbaeumer.vscode-eslint",
+ "octref.vetur",
+ "gruntfuggly.todo-tree",
+ ]
+}
\ No newline at end of file
From c69e5915f1ef1c10f34cb2fa82d1629b565848fe Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:07:02 +0200
Subject: [PATCH 05/28] backend pretier, more linting rules
---
backend/.eslintrc.js | 38 ++++++++++++++++++++++----------------
backend/.prettierrc.js | 9 +++++++++
backend/package.json | 1 +
webapp/.eslintrc.js | 4 +++-
4 files changed, 35 insertions(+), 17 deletions(-)
create mode 100644 backend/.prettierrc.js
diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js
index 0fdbfd52d..7f22883a7 100644
--- a/backend/.eslintrc.js
+++ b/backend/.eslintrc.js
@@ -1,20 +1,26 @@
module.exports = {
- "extends": "standard",
- "parser": "babel-eslint",
- "env": {
- "es6": true,
- "node": true,
- "jest/globals": true
+ env: {
+ es6: true,
+ node: true,
+ 'jest/globals': true
},
- "rules": {
- "indent": [
- "error",
- 2
- ],
- "quotes": [
- "error",
- "single"
- ]
+ parserOptions: {
+ parser: 'babel-eslint'
+ },
+ extends: [
+ 'standard',
+ 'plugin:vue/recommended',
+ 'plugin:prettier/recommended'
+ ],
+ plugins: [
+ 'jest'
+ ]
+ rules: {
+ 'indent': [ 'error', 2 ],
+ 'quotes': [ "error", "single"],
+ // 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
+ 'no-console': ['error'],
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
+ 'prettier/prettier': ['error'],
},
- "plugins": ["jest"]
};
diff --git a/backend/.prettierrc.js b/backend/.prettierrc.js
new file mode 100644
index 000000000..e2cf91e91
--- /dev/null
+++ b/backend/.prettierrc.js
@@ -0,0 +1,9 @@
+
+module.exports = {
+ semi: false,
+ printWidth: 100,
+ singleQuote: true,
+ trailingComma: "all",
+ tabWidth: 2,
+ bracketSpacing: true
+};
diff --git a/backend/package.json b/backend/package.json
index d940937a8..b3d69f415 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -99,6 +99,7 @@
"eslint-plugin-import": "~2.17.2",
"eslint-plugin-jest": "~22.5.1",
"eslint-plugin-node": "~9.0.1",
+ "eslint-plugin-prettier": "~3.1.0",
"eslint-plugin-promise": "~4.1.1",
"eslint-plugin-standard": "~4.0.0",
"graphql-request": "~1.8.2",
diff --git a/webapp/.eslintrc.js b/webapp/.eslintrc.js
index f95b5c186..c70682986 100644
--- a/webapp/.eslintrc.js
+++ b/webapp/.eslintrc.js
@@ -8,6 +8,7 @@ module.exports = {
parser: 'babel-eslint'
},
extends: [
+ 'standard',
'plugin:vue/recommended',
'plugin:prettier/recommended'
],
@@ -18,7 +19,8 @@ module.exports = {
],
// add your custom rules here
rules: {
- 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
+ //'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
+ 'no-console': ['error'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'prettier/prettier': ['error'],
From 1e20bb4bce929dfec4a1ddc50a78c9060d693cf7 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:08:57 +0200
Subject: [PATCH 06/28] updated package json
---
webapp/package.json | 1 +
webapp/yarn.lock | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/webapp/package.json b/webapp/package.json
index a3e8b44b9..f5c58a731 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -90,6 +90,7 @@
"babel-eslint": "~10.0.1",
"babel-jest": "~24.8.0",
"eslint": "~5.16.0",
+ "eslint-config-standard": "~12.0.0",
"eslint-config-prettier": "~4.3.0",
"eslint-loader": "~2.1.2",
"eslint-plugin-prettier": "~3.1.0",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 24878a759..40650aaf1 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -3273,7 +3273,7 @@ cookie-universal@^2.0.14:
"@types/cookie" "^0.3.1"
cookie "^0.3.1"
-cookie@0.4.0:
+cookie@0.4.0, cookie@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
@@ -3283,11 +3283,6 @@ cookie@^0.3.1:
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=
-cookie@^0.4.0:
- version "0.4.0"
- resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
- integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
-
copy-concurrently@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0"
@@ -4181,6 +4176,11 @@ eslint-config-prettier@~4.3.0:
dependencies:
get-stdin "^6.0.0"
+eslint-config-standard@~12.0.0:
+ version "12.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9"
+ integrity sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==
+
eslint-loader@~2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.1.2.tgz#453542a1230d6ffac90e4e7cb9cadba9d851be68"
From d9bd2641063294234fbc06de75b219a1740e6a03 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:11:37 +0200
Subject: [PATCH 07/28] updated package json
---
webapp/package.json | 1 +
webapp/yarn.lock | 140 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 139 insertions(+), 2 deletions(-)
diff --git a/webapp/package.json b/webapp/package.json
index f5c58a731..b9bccf82f 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -93,6 +93,7 @@
"eslint-config-standard": "~12.0.0",
"eslint-config-prettier": "~4.3.0",
"eslint-loader": "~2.1.2",
+ "eslint-plugin-import": "~2.17.2",
"eslint-plugin-prettier": "~3.1.0",
"eslint-plugin-vue": "~5.2.2",
"fuse.js": "^3.4.4",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 40650aaf1..bf7841d33 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -2133,6 +2133,14 @@ array-flatten@1.1.1:
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=
+array-includes@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d"
+ integrity sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=
+ dependencies:
+ define-properties "^1.1.2"
+ es-abstract "^1.7.0"
+
array-map@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662"
@@ -3233,6 +3241,11 @@ constants-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75"
integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=
+contains-path@^0.1.0:
+ version "0.1.0"
+ resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a"
+ integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=
+
content-disposition@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
@@ -3727,7 +3740,7 @@ de-indent@^1.0.2:
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=
-debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8:
+debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
@@ -3888,6 +3901,14 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"
+doctrine@1.5.0:
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa"
+ integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=
+ dependencies:
+ esutils "^2.0.2"
+ isarray "^1.0.0"
+
doctrine@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
@@ -4119,7 +4140,7 @@ error-stack-parser@^2.0.0:
dependencies:
stackframe "^1.0.4"
-es-abstract@^1.12.0, es-abstract@^1.4.3, es-abstract@^1.5.1:
+es-abstract@^1.12.0, es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9"
integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==
@@ -4181,6 +4202,14 @@ eslint-config-standard@~12.0.0:
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9"
integrity sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==
+eslint-import-resolver-node@^0.3.2:
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a"
+ integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==
+ dependencies:
+ debug "^2.6.9"
+ resolve "^1.5.0"
+
eslint-loader@~2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.1.2.tgz#453542a1230d6ffac90e4e7cb9cadba9d851be68"
@@ -4192,6 +4221,31 @@ eslint-loader@~2.1.2:
object-hash "^1.1.4"
rimraf "^2.6.1"
+eslint-module-utils@^2.4.0:
+ version "2.4.0"
+ resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz#8b93499e9b00eab80ccb6614e69f03678e84e09a"
+ integrity sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw==
+ dependencies:
+ debug "^2.6.8"
+ pkg-dir "^2.0.0"
+
+eslint-plugin-import@~2.17.2:
+ version "2.17.2"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.2.tgz#d227d5c6dc67eca71eb590d2bb62fb38d86e9fcb"
+ integrity sha512-m+cSVxM7oLsIpmwNn2WXTJoReOF9f/CtLMo7qOVmKd1KntBy0hEcuNZ3erTmWjx+DxRO0Zcrm5KwAvI9wHcV5g==
+ dependencies:
+ array-includes "^3.0.3"
+ contains-path "^0.1.0"
+ debug "^2.6.9"
+ doctrine "1.5.0"
+ eslint-import-resolver-node "^0.3.2"
+ eslint-module-utils "^2.4.0"
+ has "^1.0.3"
+ lodash "^4.17.11"
+ minimatch "^3.0.4"
+ read-pkg-up "^2.0.0"
+ resolve "^1.10.0"
+
eslint-plugin-prettier@^3.0.0, eslint-plugin-prettier@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d"
@@ -4692,6 +4746,13 @@ find-up@^1.0.0:
path-exists "^2.0.0"
pinkie-promise "^2.0.0"
+find-up@^2.0.0, find-up@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
+ integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c=
+ dependencies:
+ locate-path "^2.0.0"
+
find-up@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73"
@@ -6633,6 +6694,16 @@ load-json-file@^1.0.0:
pinkie-promise "^2.0.0"
strip-bom "^2.0.0"
+load-json-file@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8"
+ integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=
+ dependencies:
+ graceful-fs "^4.1.2"
+ parse-json "^2.2.0"
+ pify "^2.0.0"
+ strip-bom "^3.0.0"
+
load-json-file@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b"
@@ -6675,6 +6746,14 @@ loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.0.4, loader-utils@^1.1
emojis-list "^2.0.0"
json5 "^1.0.1"
+locate-path@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
+ integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=
+ dependencies:
+ p-locate "^2.0.0"
+ path-exists "^3.0.0"
+
locate-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
@@ -7725,6 +7804,13 @@ p-is-promise@^2.0.0:
resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e"
integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==
+p-limit@^1.1.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"
+ integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==
+ dependencies:
+ p-try "^1.0.0"
+
p-limit@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2"
@@ -7732,6 +7818,13 @@ p-limit@^2.0.0:
dependencies:
p-try "^2.0.0"
+p-locate@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
+ integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=
+ dependencies:
+ p-limit "^1.1.0"
+
p-locate@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4"
@@ -7744,6 +7837,11 @@ p-reduce@^1.0.0:
resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa"
integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=
+p-try@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
+ integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=
+
p-try@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
@@ -7892,6 +7990,13 @@ path-type@^1.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
+path-type@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73"
+ integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=
+ dependencies:
+ pify "^2.0.0"
+
path-type@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
@@ -7961,6 +8066,13 @@ pkg-dir@^1.0.0:
dependencies:
find-up "^1.0.0"
+pkg-dir@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b"
+ integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=
+ dependencies:
+ find-up "^2.1.0"
+
pkg-dir@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3"
@@ -9046,6 +9158,14 @@ read-pkg-up@^1.0.1:
find-up "^1.0.0"
read-pkg "^1.0.0"
+read-pkg-up@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
+ integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=
+ dependencies:
+ find-up "^2.0.0"
+ read-pkg "^2.0.0"
+
read-pkg-up@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978"
@@ -9063,6 +9183,15 @@ read-pkg@^1.0.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"
+read-pkg@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8"
+ integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=
+ dependencies:
+ load-json-file "^2.0.0"
+ normalize-package-data "^2.3.2"
+ path-type "^2.0.0"
+
read-pkg@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389"
@@ -9350,6 +9479,13 @@ resolve@^1.1.7, resolve@^1.10.0, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.8.1:
dependencies:
path-parse "^1.0.6"
+resolve@^1.5.0:
+ version "1.11.0"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
+ integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
+ dependencies:
+ path-parse "^1.0.6"
+
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
From beab5571fdfb5dd00169e2920484fb9170c6d6e4 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:12:31 +0200
Subject: [PATCH 08/28] included license and author in package.json
---
webapp/package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/webapp/package.json b/webapp/package.json
index b9bccf82f..4bd257137 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -6,7 +6,8 @@
"Grzegorz Leoniec (appinteractive)",
"ulfgebhardt"
],
- "author": "",
+ "license": "MIT",
+ "author": "Human Connection gGmbH",
"private": false,
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
From 1dc8f1a15fb825815a5aacbc4b1be8d83c1698cc Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:17:56 +0200
Subject: [PATCH 09/28] dependencies
---
webapp/package.json | 2 ++
webapp/yarn.lock | 29 +++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/webapp/package.json b/webapp/package.json
index 4bd257137..68da78339 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -95,7 +95,9 @@
"eslint-config-prettier": "~4.3.0",
"eslint-loader": "~2.1.2",
"eslint-plugin-import": "~2.17.2",
+ "eslint-plugin-node": "~9.0.1",
"eslint-plugin-prettier": "~3.1.0",
+ "eslint-plugin-promise": "~4.1.1",
"eslint-plugin-vue": "~5.2.2",
"fuse.js": "^3.4.4",
"jest": "~24.8.0",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index bf7841d33..a6cae543b 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -4229,6 +4229,14 @@ eslint-module-utils@^2.4.0:
debug "^2.6.8"
pkg-dir "^2.0.0"
+eslint-plugin-es@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-1.4.0.tgz#475f65bb20c993fc10e8c8fe77d1d60068072da6"
+ integrity sha512-XfFmgFdIUDgvaRAlaXUkxrRg5JSADoRC8IkKLc/cISeR3yHVMefFHQZpcyXXEUUPHfy5DwviBcrfqlyqEwlQVw==
+ dependencies:
+ eslint-utils "^1.3.0"
+ regexpp "^2.0.1"
+
eslint-plugin-import@~2.17.2:
version "2.17.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.2.tgz#d227d5c6dc67eca71eb590d2bb62fb38d86e9fcb"
@@ -4246,6 +4254,18 @@ eslint-plugin-import@~2.17.2:
read-pkg-up "^2.0.0"
resolve "^1.10.0"
+eslint-plugin-node@~9.0.1:
+ version "9.0.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-9.0.1.tgz#93e44626fa62bcb6efea528cee9687663dc03b62"
+ integrity sha512-fljT5Uyy3lkJzuqhxrYanLSsvaILs9I7CmQ31atTtZ0DoIzRbbvInBh4cQ1CrthFHInHYBQxfPmPt6KLHXNXdw==
+ dependencies:
+ eslint-plugin-es "^1.4.0"
+ eslint-utils "^1.3.1"
+ ignore "^5.1.1"
+ minimatch "^3.0.4"
+ resolve "^1.10.1"
+ semver "^6.0.0"
+
eslint-plugin-prettier@^3.0.0, eslint-plugin-prettier@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d"
@@ -4253,6 +4273,11 @@ eslint-plugin-prettier@^3.0.0, eslint-plugin-prettier@~3.1.0:
dependencies:
prettier-linter-helpers "^1.0.0"
+eslint-plugin-promise@~4.1.1:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz#1e08cb68b5b2cd8839f8d5864c796f56d82746db"
+ integrity sha512-faAHw7uzlNPy7b45J1guyjazw28M+7gJokKUjC5JSFoYfUEyy6Gw/i7YQvmv2Yk00sUjWcmzXQLpU1Ki/C2IZQ==
+
eslint-plugin-vue@~5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.2.tgz#86601823b7721b70bc92d54f1728cfc03b36283c"
@@ -4276,7 +4301,7 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3:
esrecurse "^4.1.0"
estraverse "^4.1.1"
-eslint-utils@^1.3.1:
+eslint-utils@^1.3.0, eslint-utils@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512"
integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==
@@ -9479,7 +9504,7 @@ resolve@^1.1.7, resolve@^1.10.0, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.8.1:
dependencies:
path-parse "^1.0.6"
-resolve@^1.5.0:
+resolve@^1.10.1, resolve@^1.5.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
From 9edce764e382218744349e4e151fd718df0219c8 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:18:48 +0200
Subject: [PATCH 10/28] dependencies
---
webapp/package.json | 1 +
webapp/yarn.lock | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/webapp/package.json b/webapp/package.json
index 68da78339..f96b3f2bd 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -98,6 +98,7 @@
"eslint-plugin-node": "~9.0.1",
"eslint-plugin-prettier": "~3.1.0",
"eslint-plugin-promise": "~4.1.1",
+ "eslint-plugin-standard": "~4.0.0",
"eslint-plugin-vue": "~5.2.2",
"fuse.js": "^3.4.4",
"jest": "~24.8.0",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index a6cae543b..6fba0f1c3 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -4278,6 +4278,11 @@ eslint-plugin-promise@~4.1.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz#1e08cb68b5b2cd8839f8d5864c796f56d82746db"
integrity sha512-faAHw7uzlNPy7b45J1guyjazw28M+7gJokKUjC5JSFoYfUEyy6Gw/i7YQvmv2Yk00sUjWcmzXQLpU1Ki/C2IZQ==
+eslint-plugin-standard@~4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz#f845b45109c99cd90e77796940a344546c8f6b5c"
+ integrity sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==
+
eslint-plugin-vue@~5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.2.tgz#86601823b7721b70bc92d54f1728cfc03b36283c"
From afbfd00becc1a58190d95bbc52f581959be939aa Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:22:49 +0200
Subject: [PATCH 11/28] jest plugin for eslint
---
webapp/.eslintrc.js | 3 ++-
webapp/package.json | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/webapp/.eslintrc.js b/webapp/.eslintrc.js
index c70682986..72d56538f 100644
--- a/webapp/.eslintrc.js
+++ b/webapp/.eslintrc.js
@@ -15,7 +15,8 @@ module.exports = {
// required to lint *.vue files
plugins: [
'vue',
- 'prettier'
+ 'prettier',
+ 'jest'
],
// add your custom rules here
rules: {
diff --git a/webapp/package.json b/webapp/package.json
index f96b3f2bd..372ad6e1d 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -95,6 +95,7 @@
"eslint-config-prettier": "~4.3.0",
"eslint-loader": "~2.1.2",
"eslint-plugin-import": "~2.17.2",
+ "eslint-plugin-jest": "~22.5.1",
"eslint-plugin-node": "~9.0.1",
"eslint-plugin-prettier": "~3.1.0",
"eslint-plugin-promise": "~4.1.1",
From c7070fe4d6d542c2dac9de6d23cd1456bb59b5c3 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:26:30 +0200
Subject: [PATCH 12/28] fixes
---
webapp/.eslintrc.js | 3 ++-
webapp/yarn.lock | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/webapp/.eslintrc.js b/webapp/.eslintrc.js
index 72d56538f..0400fe5f2 100644
--- a/webapp/.eslintrc.js
+++ b/webapp/.eslintrc.js
@@ -2,7 +2,8 @@ module.exports = {
root: true,
env: {
browser: true,
- node: true
+ node: true,
+ jest: true
},
parserOptions: {
parser: 'babel-eslint'
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 6fba0f1c3..d47b0a14c 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -4254,6 +4254,11 @@ eslint-plugin-import@~2.17.2:
read-pkg-up "^2.0.0"
resolve "^1.10.0"
+eslint-plugin-jest@~22.5.1:
+ version "22.5.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.5.1.tgz#a31dfe9f9513c6af7c17ece4c65535a1370f060b"
+ integrity sha512-c3WjZR/HBoi4GedJRwo2OGHa8Pzo1EbSVwQ2HFzJ+4t2OoYM7Alx646EH/aaxZ+9eGcPiq0FT0UGkRuFFx2FHg==
+
eslint-plugin-node@~9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-9.0.1.tgz#93e44626fa62bcb6efea528cee9687663dc03b62"
From 161921c9110e174297112783e7459b484a5cd3f0 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:29:21 +0200
Subject: [PATCH 13/28] fixes
---
backend/.eslintrc.js | 2 +-
backend/yarn.lock | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js
index 7f22883a7..50eb4ff79 100644
--- a/backend/.eslintrc.js
+++ b/backend/.eslintrc.js
@@ -14,7 +14,7 @@ module.exports = {
],
plugins: [
'jest'
- ]
+ ],
rules: {
'indent': [ 'error', 2 ],
'quotes': [ "error", "single"],
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 7a24e16ca..867c33389 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -3054,6 +3054,13 @@ eslint-plugin-node@~9.0.1:
resolve "^1.10.1"
semver "^6.0.0"
+eslint-plugin-prettier@~3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d"
+ integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA==
+ dependencies:
+ prettier-linter-helpers "^1.0.0"
+
eslint-plugin-promise@~4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz#1e08cb68b5b2cd8839f8d5864c796f56d82746db"
@@ -3360,6 +3367,11 @@ fast-deep-equal@^2.0.1:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
+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-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
@@ -6184,6 +6196,13 @@ prepend-http@^1.0.1:
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"
+
pretty-format@^24.8.0:
version "24.8.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2"
From b4e7b9c40f6bdff925ff81e99feed8cfc81f832d Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:31:03 +0200
Subject: [PATCH 14/28] dependencies
---
backend/package.json | 1 +
backend/yarn.lock | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/backend/package.json b/backend/package.json
index b3d69f415..b737bed6c 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -96,6 +96,7 @@
"cucumber": "~5.1.0",
"eslint": "~5.16.0",
"eslint-config-standard": "~12.0.0",
+ "eslint-config-prettier": "~4.3.0",
"eslint-plugin-import": "~2.17.2",
"eslint-plugin-jest": "~22.5.1",
"eslint-plugin-node": "~9.0.1",
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 867c33389..8499fae0c 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -2991,6 +2991,13 @@ escodegen@^1.9.1:
optionalDependencies:
source-map "~0.6.1"
+eslint-config-prettier@~4.3.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.3.0.tgz#c55c1fcac8ce4518aeb77906984e134d9eb5a4f0"
+ integrity sha512-sZwhSTHVVz78+kYD3t5pCWSYEdVSBR0PXnwjDRsUs8ytIrK8PLXw+6FKp8r3Z7rx4ZszdetWlXYKOHoUrrwPlA==
+ dependencies:
+ get-stdin "^6.0.0"
+
eslint-config-standard@~12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9"
@@ -3583,6 +3590,11 @@ get-func-name@^2.0.0:
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=
+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@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
From e3f9d1fe73b9dfd30f369d9ee4821383d435a145 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:33:12 +0200
Subject: [PATCH 15/28] dependencies, fixes
---
backend/.eslintrc.js | 1 -
backend/package.json | 1 +
backend/yarn.lock | 5 +++++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js
index 50eb4ff79..0028743f8 100644
--- a/backend/.eslintrc.js
+++ b/backend/.eslintrc.js
@@ -9,7 +9,6 @@ module.exports = {
},
extends: [
'standard',
- 'plugin:vue/recommended',
'plugin:prettier/recommended'
],
plugins: [
diff --git a/backend/package.json b/backend/package.json
index b737bed6c..a97fe7f29 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -106,6 +106,7 @@
"graphql-request": "~1.8.2",
"jest": "~24.8.0",
"nodemon": "~1.19.0",
+ "prettier": "~1.14.3",
"supertest": "~4.0.2"
}
}
\ No newline at end of file
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 8499fae0c..6fcfaac93 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -6215,6 +6215,11 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
+prettier@~1.14.3:
+ version "1.14.3"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895"
+ integrity sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==
+
pretty-format@^24.8.0:
version "24.8.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2"
From 341baa5e3b0abe0ae4d8fda57846a04d58070950 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Sat, 18 May 2019 15:43:26 +0200
Subject: [PATCH 16/28] fixed lint rules
---
backend/.eslintrc.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js
index 0028743f8..0000bb066 100644
--- a/backend/.eslintrc.js
+++ b/backend/.eslintrc.js
@@ -2,7 +2,7 @@ module.exports = {
env: {
es6: true,
node: true,
- 'jest/globals': true
+ jest: true
},
parserOptions: {
parser: 'babel-eslint'
@@ -15,8 +15,8 @@ module.exports = {
'jest'
],
rules: {
- 'indent': [ 'error', 2 ],
- 'quotes': [ "error", "single"],
+ //'indent': [ 'error', 2 ],
+ //'quotes': [ "error", "single"],
// 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': ['error'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
From 30c9f7d4512d0af0da6dcb950ad1ca2e79f0e6f2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Wed, 22 May 2019 04:52:24 +0000
Subject: [PATCH 17/28] Bump apollo-cache-inmemory from 1.5.1 to 1.6.0 in
/backend
Bumps [apollo-cache-inmemory](https://github.com/apollographql/apollo-client) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/apollographql/apollo-client/releases)
- [Changelog](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/apollographql/apollo-client/compare/apollo-cache-inmemory@1.5.1...apollo-cache-inmemory@1.6.0)
Signed-off-by: dependabot[bot]
---
backend/package.json | 2 +-
backend/yarn.lock | 66 ++++++++++++++++++++++++++++++--------------
2 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/backend/package.json b/backend/package.json
index 9d5b5c1f0..c88aaeabd 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -44,7 +44,7 @@
},
"dependencies": {
"activitystrea.ms": "~2.1.3",
- "apollo-cache-inmemory": "~1.5.1",
+ "apollo-cache-inmemory": "~1.6.0",
"apollo-client": "~2.5.1",
"apollo-link-context": "~1.0.14",
"apollo-link-http": "~1.5.14",
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 1a7fd871e..f152bcb7d 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -1141,6 +1141,13 @@
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d"
integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg==
+"@wry/context@^0.4.0":
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.4.0.tgz#8a8718408e4dd0514a0f8f4231bb4b87130b34e3"
+ integrity sha512-rVjwzFjVYXJ8pWJ8ZRCHv6meOebQvfTlvnUYUNX93Ce0KNeMTqCkf0GiOJc6BNVB96s7qfvwoLN3nUgDnSFOOg==
+ dependencies:
+ tslib "^1.9.3"
+
abab@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f"
@@ -1296,18 +1303,18 @@ apollo-cache-control@^0.1.0:
dependencies:
graphql-extensions "^0.0.x"
-apollo-cache-inmemory@~1.5.1:
- version "1.5.1"
- resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.5.1.tgz#265d1ee67b0bf0aca9c37629d410bfae44e62953"
- integrity sha512-D3bdpPmWfaKQkWy8lfwUg+K8OBITo3sx0BHLs1B/9vIdOIZ7JNCKq3EUcAgAfInomJUdN0QG1yOfi8M8hxkN1g==
+apollo-cache-inmemory@~1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.6.0.tgz#a106cdc520f0a043be2575372d5dbb7e4790254c"
+ integrity sha512-Mr86ucMsXnRH9YRvcuuy6kc3dtyRBuVSo8gdxp2sJVuUAtvQ6r/8E+ok2qX84em9ZBAYxoyvPnKeShhvcKiiDw==
dependencies:
- apollo-cache "^1.2.1"
- apollo-utilities "^1.2.1"
- optimism "^0.6.9"
- ts-invariant "^0.2.1"
+ apollo-cache "^1.3.0"
+ apollo-utilities "^1.3.0"
+ optimism "^0.9.0"
+ ts-invariant "^0.4.0"
tslib "^1.9.3"
-apollo-cache@1.2.1, apollo-cache@^1.2.1:
+apollo-cache@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.2.1.tgz#aae71eb4a11f1f7322adc343f84b1a39b0693644"
integrity sha512-nzFmep/oKlbzUuDyz6fS6aYhRmfpcHWqNkkA9Bbxwk18RD6LXC4eZkuE0gXRX0IibVBHNjYVK+Szi0Yied4SpQ==
@@ -1315,6 +1322,14 @@ apollo-cache@1.2.1, apollo-cache@^1.2.1:
apollo-utilities "^1.2.1"
tslib "^1.9.3"
+apollo-cache@^1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.3.0.tgz#de5c907cbd329440c9b0aafcbe8436391b9e6142"
+ integrity sha512-voPlvSIDA2pY3+7QwtXPs7o5uSNAVjUKwimyHWoiW0MIZtPxawtOV/Y+BL85R227JqcjPic1El+QToVR8l4ytQ==
+ dependencies:
+ apollo-utilities "^1.3.0"
+ tslib "^1.9.3"
+
apollo-client@~2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.5.1.tgz#36126ed1d32edd79c3713c6684546a3bea80e6d1"
@@ -1567,7 +1582,7 @@ apollo-upload-server@^7.0.0:
http-errors "^1.7.0"
object-path "^0.11.4"
-apollo-utilities@1.2.1, apollo-utilities@^1.0.1, apollo-utilities@^1.2.1:
+apollo-utilities@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.2.1.tgz#1c3a1ebf5607d7c8efe7636daaf58e7463b41b3c"
integrity sha512-Zv8Udp9XTSFiN8oyXOjf6PMHepD4yxxReLsl6dPUy5Ths7jti3nmlBzZUOxuTWRwZn0MoclqL7RQ5UEJN8MAxg==
@@ -1576,6 +1591,15 @@ apollo-utilities@1.2.1, apollo-utilities@^1.0.1, apollo-utilities@^1.2.1:
ts-invariant "^0.2.1"
tslib "^1.9.3"
+apollo-utilities@^1.0.1, apollo-utilities@^1.2.1, apollo-utilities@^1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.0.tgz#9803724c07ac94ca11dc26397edb58735d2b0211"
+ integrity sha512-wQjV+FdWcTWmWUFlChG5rS0vHKy5OsXC6XlV9STRstQq6VbXANwHy6DHnTEQAfLXWAbNcPgBu+nBUpR3dFhwrA==
+ dependencies:
+ fast-json-stable-stringify "^2.0.0"
+ ts-invariant "^0.4.0"
+ tslib "^1.9.3"
+
aproba@^1.0.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
@@ -4092,11 +4116,6 @@ ignore@^5.1.1:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.1.tgz#2fc6b8f518aff48fef65a7f348ed85632448e4a5"
integrity sha512-DWjnQIFLenVrwyRCKZT+7a7/U4Cqgar4WG8V++K3hw+lrW1hc/SIwdiGmtxKCVACmHULTuGeBbHJmbwW7/sAvA==
-immutable-tuple@^0.4.9:
- version "0.4.9"
- resolved "https://registry.yarnpkg.com/immutable-tuple/-/immutable-tuple-0.4.9.tgz#473ebdd6c169c461913a454bf87ef8f601a20ff0"
- integrity sha512-LWbJPZnidF8eczu7XmcnLBsumuyRBkpwIRPCZxlojouhBo5jEBO4toj6n7hMy6IxHU/c+MqDSWkvaTpPlMQcyA==
-
import-fresh@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390"
@@ -5851,12 +5870,12 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"
-optimism@^0.6.9:
- version "0.6.9"
- resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.6.9.tgz#19258ff8b3be0cea29ac35f06bff818e026e30bb"
- integrity sha512-xoQm2lvXbCA9Kd7SCx6y713Y7sZ6fUc5R6VYpoL5M6svKJbTuvtNopexK8sO8K4s0EOUYHuPN2+yAEsNyRggkQ==
+optimism@^0.9.0:
+ version "0.9.5"
+ resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.9.5.tgz#b8b5dc9150e97b79ddbf2d2c6c0e44de4d255527"
+ integrity sha512-lNvmuBgONAGrUbj/xpH69FjMOz1d0jvMNoOCKyVynUPzq2jgVlGL4jFYJqrUHzUfBv+jAFSCP61x5UkfbduYJA==
dependencies:
- immutable-tuple "^0.4.9"
+ "@wry/context" "^0.4.0"
optimist@^0.6.1:
version "0.6.1"
@@ -7510,6 +7529,13 @@ ts-invariant@^0.3.2:
dependencies:
tslib "^1.9.3"
+ts-invariant@^0.4.0:
+ version "0.4.2"
+ resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.2.tgz#8685131b8083e67c66d602540e78763408be9113"
+ integrity sha512-PTAAn8lJPEdRBJJEs4ig6MVZWfO12yrFzV7YaPslmyhG7+4MA279y4BXT3f72gXeVl0mC1aAWq2rMX4eKTWU/Q==
+ dependencies:
+ tslib "^1.9.3"
+
tslib@^1.9.0, tslib@^1.9.3:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
From 4335ca30650717e82aa93e4d779d1846897358b3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Wed, 22 May 2019 04:52:49 +0000
Subject: [PATCH 18/28] Bump @babel/core from 7.4.4 to 7.4.5 in /backend
Bumps [@babel/core](https://github.com/babel/babel) from 7.4.4 to 7.4.5.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.4.4...v7.4.5)
Signed-off-by: dependabot[bot]
---
backend/package.json | 2 +-
backend/yarn.lock | 30 +++++++++++++++---------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/backend/package.json b/backend/package.json
index 9d5b5c1f0..c2c772916 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -83,7 +83,7 @@
},
"devDependencies": {
"@babel/cli": "~7.4.4",
- "@babel/core": "~7.4.4",
+ "@babel/core": "~7.4.5",
"@babel/node": "~7.2.2",
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
"@babel/preset-env": "~7.4.4",
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 1a7fd871e..f9884bf10 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -38,17 +38,17 @@
dependencies:
"@babel/highlight" "^7.0.0"
-"@babel/core@^7.1.0", "@babel/core@~7.4.4":
- version "7.4.4"
- resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.4.tgz#84055750b05fcd50f9915a826b44fa347a825250"
- integrity sha512-lQgGX3FPRgbz2SKmhMtYgJvVzGZrmjaF4apZ2bLwofAKiSjxU0drPh4S/VasyYXwaTs+A1gvQ45BN8SQJzHsQQ==
+"@babel/core@^7.1.0", "@babel/core@~7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.5.tgz#081f97e8ffca65a9b4b0fdc7e274e703f000c06a"
+ integrity sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA==
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/generator" "^7.4.4"
"@babel/helpers" "^7.4.4"
- "@babel/parser" "^7.4.4"
+ "@babel/parser" "^7.4.5"
"@babel/template" "^7.4.4"
- "@babel/traverse" "^7.4.4"
+ "@babel/traverse" "^7.4.5"
"@babel/types" "^7.4.4"
convert-source-map "^1.1.0"
debug "^4.1.0"
@@ -289,10 +289,10 @@
lodash "^4.17.10"
v8flags "^3.1.1"
-"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.4":
- version "7.4.4"
- resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.4.tgz#5977129431b8fe33471730d255ce8654ae1250b6"
- integrity sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==
+"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.4", "@babel/parser@^7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.5.tgz#04af8d5d5a2b044a2a1bffacc1e5e6673544e872"
+ integrity sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew==
"@babel/plugin-proposal-async-generator-functions@^7.2.0":
version "7.2.0"
@@ -720,16 +720,16 @@
"@babel/parser" "^7.4.4"
"@babel/types" "^7.4.4"
-"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4":
- version "7.4.4"
- resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.4.tgz#0776f038f6d78361860b6823887d4f3937133fe8"
- integrity sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A==
+"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.5.tgz#4e92d1728fd2f1897dafdd321efbff92156c3216"
+ integrity sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A==
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/generator" "^7.4.4"
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-split-export-declaration" "^7.4.4"
- "@babel/parser" "^7.4.4"
+ "@babel/parser" "^7.4.5"
"@babel/types" "^7.4.4"
debug "^4.1.0"
globals "^11.1.0"
From 3b9351fdcbc6a5320ee6ab728660f3102a9e0b37 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Thu, 23 May 2019 04:55:48 +0000
Subject: [PATCH 19/28] Bump cypress-plugin-retries from 1.2.1 to 1.2.2
Bumps [cypress-plugin-retries](https://github.com/Bkucera/cypress-plugin-retries) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/Bkucera/cypress-plugin-retries/releases)
- [Commits](https://github.com/Bkucera/cypress-plugin-retries/compare/v1.2.1...v1.2.2)
Signed-off-by: dependabot[bot]
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 272e7785e..97dd53c3c 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"cross-env": "^5.2.0",
"cypress": "^3.3.0",
"cypress-cucumber-preprocessor": "^1.11.2",
- "cypress-plugin-retries": "^1.2.1",
+ "cypress-plugin-retries": "^1.2.2",
"dotenv": "^8.0.0",
"faker": "^4.1.0",
"graphql-request": "^1.8.2",
diff --git a/yarn.lock b/yarn.lock
index e363d28ea..ea84a058b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1815,10 +1815,10 @@ cypress-cucumber-preprocessor@^1.11.2:
glob "^7.1.2"
through "^2.3.8"
-cypress-plugin-retries@^1.2.1:
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/cypress-plugin-retries/-/cypress-plugin-retries-1.2.1.tgz#0ae296e41c00c1aa1c2da83750e84c8a684e1c6b"
- integrity sha512-iZ00NmeVfHleZ6fcDvzoUr2vPpCm+fzqzHpUF5ceY0PEJRs8BzdmIN/4AVUwLTDYdb3F1B8qK+s3GSoGe2WPQQ==
+cypress-plugin-retries@^1.2.2:
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/cypress-plugin-retries/-/cypress-plugin-retries-1.2.2.tgz#7235371ca575ad9e16f883169e7f1588379f80f2"
+ integrity sha512-+bVAqJAIwpFQbgM1mAdTgCXXhowEK0pF5DqhId2h0Wq+HQ+QQ2w3hspisVUPTY+HGvncMkddUQQGF5fATuaTvQ==
cypress@^3.3.0:
version "3.3.0"
From 117255c8c0ee76dce1bf8bf20d8a883a3227163b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Thu, 23 May 2019 05:00:54 +0000
Subject: [PATCH 20/28] Bump @nuxtjs/axios from 5.4.1 to 5.5.0 in /webapp
Bumps [@nuxtjs/axios](https://github.com/nuxt-community/axios-module) from 5.4.1 to 5.5.0.
- [Release notes](https://github.com/nuxt-community/axios-module/releases)
- [Changelog](https://github.com/nuxt-community/axios-module/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/nuxt-community/axios-module/compare/v5.4.1...v5.5.0)
Signed-off-by: dependabot[bot]
---
webapp/package.json | 2 +-
webapp/yarn.lock | 17 ++++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/webapp/package.json b/webapp/package.json
index 40a411435..cc4b01162 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -52,7 +52,7 @@
"dependencies": {
"@human-connection/styleguide": "0.5.17",
"@nuxtjs/apollo": "4.0.0-rc4.2",
- "@nuxtjs/axios": "~5.4.1",
+ "@nuxtjs/axios": "~5.5.0",
"@nuxtjs/dotenv": "~1.3.0",
"@nuxtjs/style-resources": "~0.1.2",
"accounting": "~0.4.1",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 745770173..cae00636c 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -1115,15 +1115,15 @@
vue-cli-plugin-apollo "^0.20.0"
webpack-node-externals "^1.7.2"
-"@nuxtjs/axios@~5.4.1":
- version "5.4.1"
- resolved "https://registry.yarnpkg.com/@nuxtjs/axios/-/axios-5.4.1.tgz#8dbc841e939c082271f7053edc1180bf5a441ee3"
- integrity sha512-SvN6Ixs9d2AHdaB8PF4ZXr9azg4r3ynaomtr71+wMox3EEFfZHBQmAFz6lOY/CqbLRlJqYVDPKPvfIcSnngktw==
+"@nuxtjs/axios@~5.5.0":
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/@nuxtjs/axios/-/axios-5.5.0.tgz#d099691b742190b56a1627ed44821372368213c2"
+ integrity sha512-BumibwUpfJcsormwoRSbDxLSXqPM2yV1v7GyIPtzEWwM5jJZ4GFhleL6yeKuyfb1PEOkRtydsX/dja2TnGl2WA==
dependencies:
"@nuxtjs/proxy" "^1.3.3"
axios "^0.18.0"
axios-retry "^3.1.2"
- consola "^2.5.6"
+ consola "^2.6.2"
"@nuxtjs/dotenv@~1.3.0":
version "1.3.0"
@@ -3199,12 +3199,7 @@ connect@^3.6.6:
parseurl "~1.3.2"
utils-merge "1.0.1"
-consola@^2.0.0-1, consola@^2.3.0, consola@^2.4.0, consola@^2.5.6, consola@^2.6.0:
- version "2.6.0"
- resolved "https://registry.yarnpkg.com/consola/-/consola-2.6.0.tgz#ddf4e2a4361f67c120aa8bb41a0bd3cdbb58636e"
- integrity sha512-jge0Ip1NVoOafxZq1zxG1sLYVBtKV45BF39VV6YKSWb45nyLOHY51YP0+cBQ2DyOTKhCjtF0XrRJkjTvX4wzgQ==
-
-consola@^2.6.1:
+consola@^2.0.0-1, consola@^2.3.0, consola@^2.4.0, consola@^2.5.6, consola@^2.6.0, consola@^2.6.1, consola@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/consola/-/consola-2.6.2.tgz#4c1238814bb80688b19f0db97123508889577752"
integrity sha512-GNJhwvF4bJ8eiAlyB8r4WNM8kBqkl+y4DvMehMbyywoJiv37N0M6/xrKqrrZw/5maZA+UagQV8UZ+XBeuGMzUg==
From c3b16e17aec871805dfbce66ea4dd61c286bc29d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Thu, 23 May 2019 05:01:32 +0000
Subject: [PATCH 21/28] Bump tiptap from 1.19.8 to 1.20.1 in /webapp
Bumps [tiptap](https://github.com/scrumpy/tiptap) from 1.19.8 to 1.20.1.
- [Release notes](https://github.com/scrumpy/tiptap/releases)
- [Commits](https://github.com/scrumpy/tiptap/compare/tiptap@1.19.8...tiptap@1.20.1)
Signed-off-by: dependabot[bot]
---
webapp/package.json | 2 +-
webapp/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/webapp/package.json b/webapp/package.json
index 40a411435..e143dd771 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -69,7 +69,7 @@
"nuxt-env": "~0.1.0",
"stack-utils": "^1.0.2",
"string-hash": "^1.1.3",
- "tiptap": "1.19.8",
+ "tiptap": "1.20.1",
"tiptap-extensions": "1.19.10",
"v-tooltip": "~2.0.2",
"vue-count-to": "~1.0.13",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 745770173..9afbd690d 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -10328,10 +10328,10 @@ tiptap-utils@^1.5.3:
prosemirror-tables "^0.8.0"
prosemirror-utils "^0.8.2"
-tiptap@1.19.8, tiptap@^1.19.8:
- version "1.19.8"
- resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.19.8.tgz#9f140e3a533667e381701235fde672b7117e39a2"
- integrity sha512-cVxPaIBcNYDu1IsHrBUsMi8bRonRVLOG6XsnlmSy7/O/Ce5Ne4xuGaMEw5D+foShLcx5q8ldIKhLACZfnnJm7Q==
+tiptap@1.20.1, tiptap@^1.19.8:
+ version "1.20.1"
+ resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.20.1.tgz#d10fd0cd73a96bbb1f2d581da02ceda38fa8695b"
+ integrity sha512-uVGxPknq+cQH0G8yyCHvo8p3jPMLZMnkLeFjcrTyiY9PXl6XsSJwOjtIg4GXnIyCcfz2jWI5mhJGzCD26cdJGA==
dependencies:
prosemirror-commands "^1.0.8"
prosemirror-dropcursor "^1.1.1"
From cfd0975b2420ff95c39cdd1747e27c2ea868d209 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Thu, 23 May 2019 19:23:03 +0200
Subject: [PATCH 22/28] backend linting
---
backend/src/activitypub/ActivityPub.js | 233 +++++-----
backend/src/activitypub/Collections.js | 14 +-
backend/src/activitypub/NitroDataSource.js | 189 +++++----
backend/src/activitypub/routes/inbox.js | 28 +-
backend/src/activitypub/routes/index.js | 16 +-
backend/src/activitypub/routes/serveUser.js | 23 +-
backend/src/activitypub/routes/user.js | 30 +-
backend/src/activitypub/routes/verify.js | 7 +-
backend/src/activitypub/routes/webFinger.js | 10 +-
.../security/httpSignature.spec.js | 48 ++-
backend/src/activitypub/security/index.js | 78 ++--
backend/src/activitypub/utils/activity.js | 72 ++--
backend/src/activitypub/utils/actor.js | 55 ++-
backend/src/activitypub/utils/collection.js | 79 ++--
backend/src/activitypub/utils/index.js | 76 ++--
backend/src/bootstrap/directives.js | 10 +-
backend/src/bootstrap/neo4j.js | 4 +-
backend/src/bootstrap/scalars.js | 8 +-
backend/src/graphql-schema.js | 10 +-
backend/src/helpers/asyncForEach.js | 2 +-
backend/src/helpers/walkRecursive.js | 12 +-
backend/src/index.js | 2 +-
backend/src/jest/helpers.js | 4 +-
backend/src/jwt/decode.js | 6 +-
backend/src/jwt/encode.js | 5 +-
.../src/middleware/activityPubMiddleware.js | 12 +-
backend/src/middleware/dateTimeMiddleware.js | 8 +-
backend/src/middleware/excerptMiddleware.js | 4 +-
.../src/middleware/fixImageUrlsMiddleware.js | 21 +-
.../middleware/fixImageUrlsMiddleware.spec.js | 16 +-
.../middleware/includedFieldsMiddleware.js | 12 +-
backend/src/middleware/index.js | 5 +-
backend/src/middleware/nodes/locations.js | 70 +--
.../notifications/extractMentions.js | 12 +-
.../notifications/extractMentions.spec.js | 21 +-
backend/src/middleware/notifications/index.js | 6 +-
backend/src/middleware/notifications/spec.js | 29 +-
backend/src/middleware/orderByMiddleware.js | 6 +-
.../src/middleware/orderByMiddleware.spec.js | 4 +-
backend/src/middleware/passwordMiddleware.js | 4 +-
.../src/middleware/permissionsMiddleware.js | 37 +-
.../middleware/permissionsMiddleware.spec.js | 20 +-
backend/src/middleware/sluggifyMiddleware.js | 29 +-
backend/src/middleware/slugify/uniqueSlug.js | 6 +-
.../src/middleware/slugify/uniqueSlug.spec.js | 9 +-
.../src/middleware/slugifyMiddleware.spec.js | 34 +-
.../src/middleware/softDeleteMiddleware.js | 4 +-
.../middleware/softDeleteMiddleware.spec.js | 73 ++--
backend/src/middleware/userMiddleware.js | 4 +-
backend/src/middleware/validation/index.js | 4 +-
backend/src/middleware/xssMiddleware.js | 70 +--
backend/src/mocks/index.js | 7 +-
backend/src/resolvers/badges.spec.js | 48 +--
backend/src/resolvers/comments.js | 28 +-
backend/src/resolvers/comments.spec.js | 78 ++--
backend/src/resolvers/follow.js | 12 +-
backend/src/resolvers/follow.spec.js | 48 +--
backend/src/resolvers/moderation.js | 8 +-
backend/src/resolvers/moderation.spec.js | 178 ++++----
backend/src/resolvers/notifications.js | 6 +-
backend/src/resolvers/notifications.spec.js | 25 +-
backend/src/resolvers/posts.js | 13 +-
backend/src/resolvers/posts.spec.js | 31 +-
backend/src/resolvers/reports.js | 44 +-
backend/src/resolvers/reports.spec.js | 42 +-
backend/src/resolvers/rewards.js | 12 +-
backend/src/resolvers/rewards.spec.js | 76 ++--
backend/src/resolvers/shout.js | 12 +-
backend/src/resolvers/shout.spec.js | 44 +-
backend/src/resolvers/socialMedia.js | 13 +-
backend/src/resolvers/socialMedia.spec.js | 38 +-
backend/src/resolvers/statistics.js | 71 ++--
backend/src/resolvers/user_management.js | 36 +-
backend/src/resolvers/user_management.spec.js | 135 +++---
backend/src/resolvers/users.spec.js | 28 +-
backend/src/seed/factories/badges.js | 6 +-
backend/src/seed/factories/categories.js | 11 +-
backend/src/seed/factories/comments.js | 9 +-
backend/src/seed/factories/index.js | 32 +-
backend/src/seed/factories/notifications.js | 9 +-
backend/src/seed/factories/organizations.js | 6 +-
backend/src/seed/factories/posts.js | 8 +-
backend/src/seed/factories/reports.js | 9 +-
backend/src/seed/factories/tags.js | 9 +-
backend/src/seed/factories/users.js | 6 +-
backend/src/seed/reset-db.js | 6 +-
backend/src/seed/seed-db.js | 401 ++++++++++++------
backend/src/seed/seed-helpers.js | 19 +-
backend/src/server.js | 16 +-
89 files changed, 1677 insertions(+), 1444 deletions(-)
diff --git a/backend/src/activitypub/ActivityPub.js b/backend/src/activitypub/ActivityPub.js
index 3ce27e109..da1056362 100644
--- a/backend/src/activitypub/ActivityPub.js
+++ b/backend/src/activitypub/ActivityPub.js
@@ -1,13 +1,5 @@
-import {
- extractNameFromId,
- extractDomainFromUrl,
- signAndSend
-} from './utils'
-import {
- isPublicAddressed,
- sendAcceptActivity,
- sendRejectActivity
-} from './utils/activity'
+import { extractNameFromId, extractDomainFromUrl, signAndSend } from './utils'
+import { isPublicAddressed, sendAcceptActivity, sendRejectActivity } from './utils/activity'
import request from 'request'
import as from 'activitystrea.ms'
import NitroDataSource from './NitroDataSource'
@@ -22,182 +14,203 @@ let activityPub = null
export { activityPub }
export default class ActivityPub {
- constructor (activityPubEndpointUri, internalGraphQlUri) {
+ constructor(activityPubEndpointUri, internalGraphQlUri) {
this.endpoint = activityPubEndpointUri
this.dataSource = new NitroDataSource(internalGraphQlUri)
this.collections = new Collections(this.dataSource)
}
- static init (server) {
+ static init(server) {
if (!activityPub) {
dotenv.config()
- activityPub = new ActivityPub(process.env.CLIENT_URI || 'http://localhost:3000', process.env.GRAPHQL_URI || 'http://localhost:4000')
+ activityPub = new ActivityPub(
+ process.env.CLIENT_URI || 'http://localhost:3000',
+ process.env.GRAPHQL_URI || 'http://localhost:4000',
+ )
// integrate into running graphql express server
server.express.set('ap', activityPub)
server.express.use(router)
- console.log('-> ActivityPub middleware added to the graphql express server')
+ console.log('-> ActivityPub middleware added to the graphql express server') // eslint-disable-line no-console
} else {
- console.log('-> ActivityPub middleware already added to the graphql express server')
+ console.log('-> ActivityPub middleware already added to the graphql express server') // eslint-disable-line no-console
}
}
- handleFollowActivity (activity) {
+ handleFollowActivity(activity) {
debug(`inside FOLLOW ${activity.actor}`)
let toActorName = extractNameFromId(activity.object)
let fromDomain = extractDomainFromUrl(activity.actor)
const dataSource = this.dataSource
return new Promise((resolve, reject) => {
- request({
- url: activity.actor,
- headers: {
- 'Accept': 'application/activity+json'
- }
- }, async (err, response, toActorObject) => {
- if (err) return reject(err)
- // save shared inbox
- toActorObject = JSON.parse(toActorObject)
- await this.dataSource.addSharedInboxEndpoint(toActorObject.endpoints.sharedInbox)
+ request(
+ {
+ url: activity.actor,
+ headers: {
+ Accept: 'application/activity+json',
+ },
+ },
+ async (err, response, toActorObject) => {
+ if (err) return reject(err)
+ // save shared inbox
+ toActorObject = JSON.parse(toActorObject)
+ await this.dataSource.addSharedInboxEndpoint(toActorObject.endpoints.sharedInbox)
- let followersCollectionPage = await this.dataSource.getFollowersCollectionPage(activity.object)
+ let followersCollectionPage = await this.dataSource.getFollowersCollectionPage(
+ activity.object,
+ )
- const followActivity = as.follow()
- .id(activity.id)
- .actor(activity.actor)
- .object(activity.object)
+ const followActivity = as
+ .follow()
+ .id(activity.id)
+ .actor(activity.actor)
+ .object(activity.object)
- // add follower if not already in collection
- if (followersCollectionPage.orderedItems.includes(activity.actor)) {
- debug('follower already in collection!')
+ // add follower if not already in collection
+ if (followersCollectionPage.orderedItems.includes(activity.actor)) {
+ debug('follower already in collection!')
+ debug(`inbox = ${toActorObject.inbox}`)
+ resolve(
+ sendRejectActivity(followActivity, toActorName, fromDomain, toActorObject.inbox),
+ )
+ } else {
+ followersCollectionPage.orderedItems.push(activity.actor)
+ }
+ debug(`toActorObject = ${toActorObject}`)
+ toActorObject =
+ typeof toActorObject !== 'object' ? JSON.parse(toActorObject) : toActorObject
+ debug(`followers = ${JSON.stringify(followersCollectionPage.orderedItems, null, 2)}`)
debug(`inbox = ${toActorObject.inbox}`)
- resolve(sendRejectActivity(followActivity, toActorName, fromDomain, toActorObject.inbox))
- } else {
- followersCollectionPage.orderedItems.push(activity.actor)
- }
- debug(`toActorObject = ${toActorObject}`)
- toActorObject = typeof toActorObject !== 'object' ? JSON.parse(toActorObject) : toActorObject
- debug(`followers = ${JSON.stringify(followersCollectionPage.orderedItems, null, 2)}`)
- debug(`inbox = ${toActorObject.inbox}`)
- debug(`outbox = ${toActorObject.outbox}`)
- debug(`followers = ${toActorObject.followers}`)
- debug(`following = ${toActorObject.following}`)
+ debug(`outbox = ${toActorObject.outbox}`)
+ debug(`followers = ${toActorObject.followers}`)
+ debug(`following = ${toActorObject.following}`)
- try {
- await dataSource.saveFollowersCollectionPage(followersCollectionPage)
- debug('follow activity saved')
- resolve(sendAcceptActivity(followActivity, toActorName, fromDomain, toActorObject.inbox))
- } catch (e) {
- debug('followers update error!', e)
- resolve(sendRejectActivity(followActivity, toActorName, fromDomain, toActorObject.inbox))
- }
- })
+ try {
+ await dataSource.saveFollowersCollectionPage(followersCollectionPage)
+ debug('follow activity saved')
+ resolve(
+ sendAcceptActivity(followActivity, toActorName, fromDomain, toActorObject.inbox),
+ )
+ } catch (e) {
+ debug('followers update error!', e)
+ resolve(
+ sendRejectActivity(followActivity, toActorName, fromDomain, toActorObject.inbox),
+ )
+ }
+ },
+ )
})
}
- handleUndoActivity (activity) {
+ handleUndoActivity(activity) {
debug('inside UNDO')
switch (activity.object.type) {
- case 'Follow':
- const followActivity = activity.object
- return this.dataSource.undoFollowActivity(followActivity.actor, followActivity.object)
- case 'Like':
- return this.dataSource.deleteShouted(activity)
- default:
+ case 'Follow':
+ const followActivity = activity.object
+ return this.dataSource.undoFollowActivity(followActivity.actor, followActivity.object)
+ case 'Like':
+ return this.dataSource.deleteShouted(activity)
+ default:
}
}
- handleCreateActivity (activity) {
+ handleCreateActivity(activity) {
debug('inside create')
switch (activity.object.type) {
- case 'Article':
- case 'Note':
- const articleObject = activity.object
- if (articleObject.inReplyTo) {
- return this.dataSource.createComment(activity)
- } else {
- return this.dataSource.createPost(activity)
- }
- default:
+ case 'Article':
+ case 'Note':
+ const articleObject = activity.object
+ if (articleObject.inReplyTo) {
+ return this.dataSource.createComment(activity)
+ } else {
+ return this.dataSource.createPost(activity)
+ }
+ default:
}
}
- handleDeleteActivity (activity) {
+ handleDeleteActivity(activity) {
debug('inside delete')
switch (activity.object.type) {
- case 'Article':
- case 'Note':
- return this.dataSource.deletePost(activity)
- default:
+ case 'Article':
+ case 'Note':
+ return this.dataSource.deletePost(activity)
+ default:
}
}
- handleUpdateActivity (activity) {
+ handleUpdateActivity(activity) {
debug('inside update')
switch (activity.object.type) {
- case 'Note':
- case 'Article':
- return this.dataSource.updatePost(activity)
- default:
+ case 'Note':
+ case 'Article':
+ return this.dataSource.updatePost(activity)
+ default:
}
}
- handleLikeActivity (activity) {
+ handleLikeActivity(activity) {
// TODO differ if activity is an Article/Note/etc.
return this.dataSource.createShouted(activity)
}
- handleDislikeActivity (activity) {
+ handleDislikeActivity(activity) {
// TODO differ if activity is an Article/Note/etc.
return this.dataSource.deleteShouted(activity)
}
- async handleAcceptActivity (activity) {
+ async handleAcceptActivity(activity) {
debug('inside accept')
switch (activity.object.type) {
- case 'Follow':
- const followObject = activity.object
- const followingCollectionPage = await this.collections.getFollowingCollectionPage(followObject.actor)
- followingCollectionPage.orderedItems.push(followObject.object)
- await this.dataSource.saveFollowingCollectionPage(followingCollectionPage)
+ case 'Follow':
+ const followObject = activity.object
+ const followingCollectionPage = await this.collections.getFollowingCollectionPage(
+ followObject.actor,
+ )
+ followingCollectionPage.orderedItems.push(followObject.object)
+ await this.dataSource.saveFollowingCollectionPage(followingCollectionPage)
}
}
- getActorObject (url) {
+ getActorObject(url) {
return new Promise((resolve, reject) => {
- request({
- url: url,
- headers: {
- 'Accept': 'application/json'
- }
- }, (err, response, body) => {
- if (err) {
- reject(err)
- }
- resolve(JSON.parse(body))
- })
+ request(
+ {
+ url: url,
+ headers: {
+ Accept: 'application/json',
+ },
+ },
+ (err, response, body) => {
+ if (err) {
+ reject(err)
+ }
+ resolve(JSON.parse(body))
+ },
+ )
})
}
- generateStatusId (slug) {
+ generateStatusId(slug) {
return `https://${this.host}/activitypub/users/${slug}/status/${uuid()}`
}
- async sendActivity (activity) {
+ async sendActivity(activity) {
delete activity.send
const fromName = extractNameFromId(activity.actor)
if (Array.isArray(activity.to) && isPublicAddressed(activity)) {
debug('is public addressed')
const sharedInboxEndpoints = await this.dataSource.getSharedInboxEndpoints()
// serve shared inbox endpoints
- sharedInboxEndpoints.map((sharedInbox) => {
+ sharedInboxEndpoints.map(sharedInbox => {
return this.trySend(activity, fromName, new URL(sharedInbox).host, sharedInbox)
})
- activity.to = activity.to.filter((recipient) => {
- return !(isPublicAddressed({ to: recipient }))
+ activity.to = activity.to.filter(recipient => {
+ return !isPublicAddressed({ to: recipient })
})
// serve the rest
- activity.to.map(async (recipient) => {
+ activity.to.map(async recipient => {
debug('serve rest')
const actorObject = await this.getActorObject(recipient)
return this.trySend(activity, fromName, new URL(recipient).host, actorObject.inbox)
@@ -207,18 +220,18 @@ export default class ActivityPub {
const actorObject = await this.getActorObject(activity.to)
return this.trySend(activity, fromName, new URL(activity.to).host, actorObject.inbox)
} else if (Array.isArray(activity.to)) {
- activity.to.map(async (recipient) => {
+ activity.to.map(async recipient => {
const actorObject = await this.getActorObject(recipient)
return this.trySend(activity, fromName, new URL(recipient).host, actorObject.inbox)
})
}
}
- async trySend (activity, fromName, host, url, tries = 5) {
+ async trySend(activity, fromName, host, url, tries = 5) {
try {
return await signAndSend(activity, fromName, host, url)
} catch (e) {
if (tries > 0) {
- setTimeout(function () {
+ setTimeout(function() {
return this.trySend(activity, fromName, host, url, --tries)
}, 20000)
}
diff --git a/backend/src/activitypub/Collections.js b/backend/src/activitypub/Collections.js
index 227e1717b..641db596a 100644
--- a/backend/src/activitypub/Collections.js
+++ b/backend/src/activitypub/Collections.js
@@ -1,28 +1,28 @@
export default class Collections {
- constructor (dataSource) {
+ constructor(dataSource) {
this.dataSource = dataSource
}
- getFollowersCollection (actorId) {
+ getFollowersCollection(actorId) {
return this.dataSource.getFollowersCollection(actorId)
}
- getFollowersCollectionPage (actorId) {
+ getFollowersCollectionPage(actorId) {
return this.dataSource.getFollowersCollectionPage(actorId)
}
- getFollowingCollection (actorId) {
+ getFollowingCollection(actorId) {
return this.dataSource.getFollowingCollection(actorId)
}
- getFollowingCollectionPage (actorId) {
+ getFollowingCollectionPage(actorId) {
return this.dataSource.getFollowingCollectionPage(actorId)
}
- getOutboxCollection (actorId) {
+ getOutboxCollection(actorId) {
return this.dataSource.getOutboxCollection(actorId)
}
- getOutboxCollectionPage (actorId) {
+ getOutboxCollectionPage(actorId) {
return this.dataSource.getOutboxCollectionPage(actorId)
}
}
diff --git a/backend/src/activitypub/NitroDataSource.js b/backend/src/activitypub/NitroDataSource.js
index 0ab6db091..eea37337a 100644
--- a/backend/src/activitypub/NitroDataSource.js
+++ b/backend/src/activitypub/NitroDataSource.js
@@ -2,16 +2,10 @@ import {
throwErrorIfApolloErrorOccurred,
extractIdFromActivityId,
extractNameFromId,
- constructIdFromName
+ constructIdFromName,
} from './utils'
-import {
- createOrderedCollection,
- createOrderedCollectionPage
-} from './utils/collection'
-import {
- createArticleObject,
- isPublicAddressed
-} from './utils/activity'
+import { createOrderedCollection, createOrderedCollectionPage } from './utils/collection'
+import { createArticleObject, isPublicAddressed } from './utils/activity'
import crypto from 'crypto'
import gql from 'graphql-tag'
import { createHttpLink } from 'apollo-link-http'
@@ -23,35 +17,36 @@ import trunc from 'trunc-html'
const debug = require('debug')('ea:nitro-datasource')
export default class NitroDataSource {
- constructor (uri) {
+ constructor(uri) {
this.uri = uri
const defaultOptions = {
query: {
fetchPolicy: 'network-only',
- errorPolicy: 'all'
- }
+ errorPolicy: 'all',
+ },
}
const link = createHttpLink({ uri: this.uri, fetch: fetch }) // eslint-disable-line
const cache = new InMemoryCache()
const authLink = setContext((_, { headers }) => {
// generate the authentication token (maybe from env? Which user?)
- const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJuYW1lIjoiUGV0ZXIgTHVzdGlnIiwiYXZhdGFyIjoiaHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci9qb2huY2FmYXp6YS8xMjguanBnIiwiaWQiOiJ1MSIsImVtYWlsIjoiYWRtaW5AZXhhbXBsZS5vcmciLCJzbHVnIjoicGV0ZXItbHVzdGlnIiwiaWF0IjoxNTUyNDIwMTExLCJleHAiOjE2Mzg4MjAxMTEsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMCIsInN1YiI6InUxIn0.G7An1yeQUViJs-0Qj-Tc-zm0WrLCMB3M02pfPnm6xzw'
+ const token =
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJuYW1lIjoiUGV0ZXIgTHVzdGlnIiwiYXZhdGFyIjoiaHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci9qb2huY2FmYXp6YS8xMjguanBnIiwiaWQiOiJ1MSIsImVtYWlsIjoiYWRtaW5AZXhhbXBsZS5vcmciLCJzbHVnIjoicGV0ZXItbHVzdGlnIiwiaWF0IjoxNTUyNDIwMTExLCJleHAiOjE2Mzg4MjAxMTEsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMCIsInN1YiI6InUxIn0.G7An1yeQUViJs-0Qj-Tc-zm0WrLCMB3M02pfPnm6xzw'
// return the headers to the context so httpLink can read them
return {
headers: {
...headers,
- Authorization: token ? `Bearer ${token}` : ''
- }
+ Authorization: token ? `Bearer ${token}` : '',
+ },
}
})
this.client = new ApolloClient({
link: authLink.concat(link),
cache: cache,
- defaultOptions
+ defaultOptions,
})
}
- async getFollowersCollection (actorId) {
+ async getFollowersCollection(actorId) {
const slug = extractNameFromId(actorId)
debug(`slug= ${slug}`)
const result = await this.client.query({
@@ -61,7 +56,7 @@ export default class NitroDataSource {
followedByCount
}
}
- `
+ `,
})
debug('successfully fetched followers')
debug(result.data)
@@ -78,7 +73,7 @@ export default class NitroDataSource {
}
}
- async getFollowersCollectionPage (actorId) {
+ async getFollowersCollectionPage(actorId) {
const slug = extractNameFromId(actorId)
debug(`getFollowersPage slug = ${slug}`)
const result = await this.client.query({
@@ -91,7 +86,7 @@ export default class NitroDataSource {
followedByCount
}
}
- `
+ `,
})
debug(result.data)
@@ -104,9 +99,9 @@ export default class NitroDataSource {
followersCollection.totalItems = followersCount
debug(`followers = ${JSON.stringify(followers, null, 2)}`)
await Promise.all(
- followers.map(async (follower) => {
+ followers.map(async follower => {
followersCollection.orderedItems.push(constructIdFromName(follower.slug))
- })
+ }),
)
return followersCollection
@@ -115,7 +110,7 @@ export default class NitroDataSource {
}
}
- async getFollowingCollection (actorId) {
+ async getFollowingCollection(actorId) {
const slug = extractNameFromId(actorId)
const result = await this.client.query({
query: gql`
@@ -124,7 +119,7 @@ export default class NitroDataSource {
followingCount
}
}
- `
+ `,
})
debug(result.data)
@@ -141,7 +136,7 @@ export default class NitroDataSource {
}
}
- async getFollowingCollectionPage (actorId) {
+ async getFollowingCollectionPage(actorId) {
const slug = extractNameFromId(actorId)
const result = await this.client.query({
query: gql`
@@ -153,7 +148,7 @@ export default class NitroDataSource {
followingCount
}
}
- `
+ `,
})
debug(result.data)
@@ -166,9 +161,9 @@ export default class NitroDataSource {
followingCollection.totalItems = followingCount
await Promise.all(
- following.map(async (user) => {
+ following.map(async user => {
followingCollection.orderedItems.push(await constructIdFromName(user.slug))
- })
+ }),
)
return followingCollection
@@ -177,7 +172,7 @@ export default class NitroDataSource {
}
}
- async getOutboxCollection (actorId) {
+ async getOutboxCollection(actorId) {
const slug = extractNameFromId(actorId)
const result = await this.client.query({
query: gql`
@@ -192,7 +187,7 @@ export default class NitroDataSource {
}
}
}
- `
+ `,
})
debug(result.data)
@@ -209,7 +204,7 @@ export default class NitroDataSource {
}
}
- async getOutboxCollectionPage (actorId) {
+ async getOutboxCollectionPage(actorId) {
const slug = extractNameFromId(actorId)
debug(`inside getting outbox collection page => ${slug}`)
const result = await this.client.query({
@@ -232,7 +227,7 @@ export default class NitroDataSource {
}
}
}
- `
+ `,
})
debug(result.data)
@@ -243,9 +238,18 @@ export default class NitroDataSource {
const outboxCollection = createOrderedCollectionPage(slug, 'outbox')
outboxCollection.totalItems = posts.length
await Promise.all(
- posts.map(async (post) => {
- outboxCollection.orderedItems.push(await createArticleObject(post.activityId, post.objectId, post.content, post.author.slug, post.id, post.createdAt))
- })
+ posts.map(async post => {
+ outboxCollection.orderedItems.push(
+ await createArticleObject(
+ post.activityId,
+ post.objectId,
+ post.content,
+ post.author.slug,
+ post.id,
+ post.createdAt,
+ ),
+ )
+ }),
)
debug('after createNote')
@@ -255,7 +259,7 @@ export default class NitroDataSource {
}
}
- async undoFollowActivity (fromActorId, toActorId) {
+ async undoFollowActivity(fromActorId, toActorId) {
const fromUserId = await this.ensureUser(fromActorId)
const toUserId = await this.ensureUser(toActorId)
const result = await this.client.mutate({
@@ -265,13 +269,13 @@ export default class NitroDataSource {
from { name }
}
}
- `
+ `,
})
debug(`undoFollowActivity result = ${JSON.stringify(result, null, 2)}`)
throwErrorIfApolloErrorOccurred(result)
}
- async saveFollowersCollectionPage (followersCollection, onlyNewestItem = true) {
+ async saveFollowersCollectionPage(followersCollection, onlyNewestItem = true) {
debug('inside saveFollowers')
let orderedItems = followersCollection.orderedItems
const toUserName = extractNameFromId(followersCollection.id)
@@ -279,7 +283,7 @@ export default class NitroDataSource {
orderedItems = onlyNewestItem ? [orderedItems.pop()] : orderedItems
return Promise.all(
- orderedItems.map(async (follower) => {
+ orderedItems.map(async follower => {
debug(`follower = ${follower}`)
const fromUserId = await this.ensureUser(follower)
debug(`fromUserId = ${fromUserId}`)
@@ -291,22 +295,22 @@ export default class NitroDataSource {
from { name }
}
}
- `
+ `,
})
debug(`addUserFollowedBy edge = ${JSON.stringify(result, null, 2)}`)
throwErrorIfApolloErrorOccurred(result)
debug('saveFollowers: added follow edge successfully')
- })
+ }),
)
}
- async saveFollowingCollectionPage (followingCollection, onlyNewestItem = true) {
+ async saveFollowingCollectionPage(followingCollection, onlyNewestItem = true) {
debug('inside saveFollowers')
let orderedItems = followingCollection.orderedItems
const fromUserName = extractNameFromId(followingCollection.id)
const fromUserId = await this.ensureUser(constructIdFromName(fromUserName))
orderedItems = onlyNewestItem ? [orderedItems.pop()] : orderedItems
return Promise.all(
- orderedItems.map(async (following) => {
+ orderedItems.map(async following => {
debug(`follower = ${following}`)
const toUserId = await this.ensureUser(following)
debug(`fromUserId = ${fromUserId}`)
@@ -318,33 +322,45 @@ export default class NitroDataSource {
from { name }
}
}
- `
+ `,
})
debug(`addUserFollowing edge = ${JSON.stringify(result, null, 2)}`)
throwErrorIfApolloErrorOccurred(result)
debug('saveFollowing: added follow edge successfully')
- })
+ }),
)
}
- async createPost (activity) {
+ async createPost(activity) {
// TODO how to handle the to field? Now the post is just created, doesn't matter who is the recipient
// createPost
const postObject = activity.object
if (!isPublicAddressed(postObject)) {
- return debug('createPost: not send to public (sending to specific persons is not implemented yet)')
+ return debug(
+ 'createPost: not send to public (sending to specific persons is not implemented yet)',
+ )
}
- const title = postObject.summary ? postObject.summary : postObject.content.split(' ').slice(0, 5).join(' ')
+ const title = postObject.summary
+ ? postObject.summary
+ : postObject.content
+ .split(' ')
+ .slice(0, 5)
+ .join(' ')
const postId = extractIdFromActivityId(postObject.id)
debug('inside create post')
let result = await this.client.mutate({
mutation: gql`
mutation {
- CreatePost(content: "${postObject.content}", contentExcerpt: "${trunc(postObject.content, 120)}", title: "${title}", id: "${postId}", objectId: "${postObject.id}", activityId: "${activity.id}") {
+ CreatePost(content: "${postObject.content}", contentExcerpt: "${trunc(
+ postObject.content,
+ 120,
+ )}", title: "${title}", id: "${postId}", objectId: "${postObject.id}", activityId: "${
+ activity.id
+ }") {
id
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
@@ -362,13 +378,13 @@ export default class NitroDataSource {
}
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
}
- async deletePost (activity) {
+ async deletePost(activity) {
const result = await this.client.mutate({
mutation: gql`
mutation {
@@ -376,28 +392,30 @@ export default class NitroDataSource {
title
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
}
- async updatePost (activity) {
+ async updatePost(activity) {
const postObject = activity.object
const postId = extractIdFromActivityId(postObject.id)
const date = postObject.updated ? postObject.updated : new Date().toISOString()
const result = await this.client.mutate({
mutation: gql`
mutation {
- UpdatePost(content: "${postObject.content}", contentExcerpt: "${trunc(postObject.content, 120).html}", id: "${postId}", updatedAt: "${date}") {
+ UpdatePost(content: "${postObject.content}", contentExcerpt: "${
+ trunc(postObject.content, 120).html
+ }", id: "${postId}", updatedAt: "${date}") {
title
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
}
- async createShouted (activity) {
+ async createShouted(activity) {
const userId = await this.ensureUser(activity.actor)
const postId = extractIdFromActivityId(activity.object)
const result = await this.client.mutate({
@@ -409,7 +427,7 @@ export default class NitroDataSource {
}
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
if (!result.data.AddUserShouted) {
@@ -418,7 +436,7 @@ export default class NitroDataSource {
}
}
- async deleteShouted (activity) {
+ async deleteShouted(activity) {
const userId = await this.ensureUser(activity.actor)
const postId = extractIdFromActivityId(activity.object)
const result = await this.client.mutate({
@@ -430,7 +448,7 @@ export default class NitroDataSource {
}
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
if (!result.data.AddUserShouted) {
@@ -439,27 +457,27 @@ export default class NitroDataSource {
}
}
- async getSharedInboxEndpoints () {
+ async getSharedInboxEndpoints() {
const result = await this.client.query({
query: gql`
query {
- SharedInboxEndpoint {
- uri
- }
+ SharedInboxEndpoint {
+ uri
+ }
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
return result.data.SharedInboxEnpoint
}
- async addSharedInboxEndpoint (uri) {
+ async addSharedInboxEndpoint(uri) {
try {
const result = await this.client.mutate({
mutation: gql`
mutation {
CreateSharedInboxEndpoint(uri: "${uri}")
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
return true
@@ -468,16 +486,18 @@ export default class NitroDataSource {
}
}
- async createComment (activity) {
+ async createComment(activity) {
const postObject = activity.object
let result = await this.client.mutate({
mutation: gql`
mutation {
- CreateComment(content: "${postObject.content}", activityId: "${extractIdFromActivityId(activity.id)}") {
+ CreateComment(content: "${
+ postObject.content
+ }", activityId: "${extractIdFromActivityId(activity.id)}") {
id
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
@@ -485,11 +505,13 @@ export default class NitroDataSource {
const result2 = await this.client.mutate({
mutation: gql`
mutation {
- AddCommentAuthor(from: {id: "${result.data.CreateComment.id}"}, to: {id: "${toUserId}"}) {
+ AddCommentAuthor(from: {id: "${
+ result.data.CreateComment.id
+ }"}, to: {id: "${toUserId}"}) {
id
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result2)
@@ -497,11 +519,13 @@ export default class NitroDataSource {
result = await this.client.mutate({
mutation: gql`
mutation {
- AddCommentPost(from: { id: "${result.data.CreateComment.id}", to: { id: "${postId}" }}) {
+ AddCommentPost(from: { id: "${
+ result.data.CreateComment.id
+ }", to: { id: "${postId}" }}) {
id
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
@@ -513,7 +537,7 @@ export default class NitroDataSource {
* @param actorId
* @returns {Promise<*>}
*/
- async ensureUser (actorId) {
+ async ensureUser(actorId) {
debug(`inside ensureUser = ${actorId}`)
const name = extractNameFromId(actorId)
const queryResult = await this.client.query({
@@ -523,10 +547,14 @@ export default class NitroDataSource {
id
}
}
- `
+ `,
})
- if (queryResult.data && Array.isArray(queryResult.data.User) && queryResult.data.User.length > 0) {
+ if (
+ queryResult.data &&
+ Array.isArray(queryResult.data.User) &&
+ queryResult.data.User.length > 0
+ ) {
debug('ensureUser: user exists.. return id')
// user already exists.. return the id
return queryResult.data.User[0].id
@@ -534,7 +562,10 @@ export default class NitroDataSource {
debug('ensureUser: user not exists.. createUser')
// user does not exist.. create it
const pw = crypto.randomBytes(16).toString('hex')
- const slug = name.toLowerCase().split(' ').join('-')
+ const slug = name
+ .toLowerCase()
+ .split(' ')
+ .join('-')
const result = await this.client.mutate({
mutation: gql`
mutation {
@@ -542,7 +573,7 @@ export default class NitroDataSource {
id
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
diff --git a/backend/src/activitypub/routes/inbox.js b/backend/src/activitypub/routes/inbox.js
index f9cfb3794..b31b89ed4 100644
--- a/backend/src/activitypub/routes/inbox.js
+++ b/backend/src/activitypub/routes/inbox.js
@@ -7,24 +7,24 @@ const router = express.Router()
// Shared Inbox endpoint (federated Server)
// For now its only able to handle Note Activities!!
-router.post('/', async function (req, res, next) {
+router.post('/', async function(req, res, next) {
debug(`Content-Type = ${req.get('Content-Type')}`)
debug(`body = ${JSON.stringify(req.body, null, 2)}`)
debug(`Request headers = ${JSON.stringify(req.headers, null, 2)}`)
switch (req.body.type) {
- case 'Create':
- await activityPub.handleCreateActivity(req.body).catch(next)
- break
- case 'Undo':
- await activityPub.handleUndoActivity(req.body).catch(next)
- break
- case 'Follow':
- await activityPub.handleFollowActivity(req.body).catch(next)
- break
- case 'Delete':
- await activityPub.handleDeleteActivity(req.body).catch(next)
- break
- /* eslint-disable */
+ case 'Create':
+ await activityPub.handleCreateActivity(req.body).catch(next)
+ break
+ case 'Undo':
+ await activityPub.handleUndoActivity(req.body).catch(next)
+ break
+ case 'Follow':
+ await activityPub.handleFollowActivity(req.body).catch(next)
+ break
+ case 'Delete':
+ await activityPub.handleDeleteActivity(req.body).catch(next)
+ break
+ /* eslint-disable */
case 'Update':
await activityPub.handleUpdateActivity(req.body).catch(next)
break
diff --git a/backend/src/activitypub/routes/index.js b/backend/src/activitypub/routes/index.js
index 24898e766..c7d31f1c4 100644
--- a/backend/src/activitypub/routes/index.js
+++ b/backend/src/activitypub/routes/index.js
@@ -7,23 +7,21 @@ import verify from './verify'
const router = express.Router()
-router.use('/.well-known/webFinger',
- cors(),
- express.urlencoded({ extended: true }),
- webFinger
-)
-router.use('/activitypub/users',
+router.use('/.well-known/webFinger', cors(), express.urlencoded({ extended: true }), webFinger)
+router.use(
+ '/activitypub/users',
cors(),
express.json({ type: ['application/activity+json', 'application/ld+json', 'application/json'] }),
express.urlencoded({ extended: true }),
- user
+ user,
)
-router.use('/activitypub/inbox',
+router.use(
+ '/activitypub/inbox',
cors(),
express.json({ type: ['application/activity+json', 'application/ld+json', 'application/json'] }),
express.urlencoded({ extended: true }),
verify,
- inbox
+ inbox,
)
export default router
diff --git a/backend/src/activitypub/routes/serveUser.js b/backend/src/activitypub/routes/serveUser.js
index f65876741..6f4472235 100644
--- a/backend/src/activitypub/routes/serveUser.js
+++ b/backend/src/activitypub/routes/serveUser.js
@@ -2,7 +2,7 @@ import { createActor } from '../utils/actor'
const gql = require('graphql-tag')
const debug = require('debug')('ea:serveUser')
-export async function serveUser (req, res, next) {
+export async function serveUser(req, res, next) {
let name = req.params.name
if (name.startsWith('@')) {
@@ -10,21 +10,32 @@ export async function serveUser (req, res, next) {
}
debug(`name = ${name}`)
- const result = await req.app.get('ap').dataSource.client.query({
- query: gql`
+ const result = await req.app
+ .get('ap')
+ .dataSource.client.query({
+ query: gql`
query {
User(slug: "${name}") {
publicKey
}
}
- `
- }).catch(reason => { debug(`serveUser User fetch error: ${reason}`) })
+ `,
+ })
+ .catch(reason => {
+ debug(`serveUser User fetch error: ${reason}`)
+ })
if (result.data && Array.isArray(result.data.User) && result.data.User.length > 0) {
const publicKey = result.data.User[0].publicKey
const actor = createActor(name, publicKey)
debug(`actor = ${JSON.stringify(actor, null, 2)}`)
- debug(`accepts json = ${req.accepts(['application/activity+json', 'application/ld+json', 'application/json'])}`)
+ debug(
+ `accepts json = ${req.accepts([
+ 'application/activity+json',
+ 'application/ld+json',
+ 'application/json',
+ ])}`,
+ )
if (req.accepts(['application/activity+json', 'application/ld+json', 'application/json'])) {
return res.json(actor)
} else if (req.accepts('text/html')) {
diff --git a/backend/src/activitypub/routes/user.js b/backend/src/activitypub/routes/user.js
index 017891e61..9dc9b5071 100644
--- a/backend/src/activitypub/routes/user.js
+++ b/backend/src/activitypub/routes/user.js
@@ -7,7 +7,7 @@ import verify from './verify'
const router = express.Router()
const debug = require('debug')('ea:user')
-router.get('/:name', async function (req, res, next) {
+router.get('/:name', async function(req, res, next) {
debug('inside user.js -> serveUser')
await serveUser(req, res, next)
})
@@ -45,24 +45,24 @@ router.get('/:name/outbox', (req, res) => {
}
})
-router.post('/:name/inbox', verify, async function (req, res, next) {
+router.post('/:name/inbox', verify, async function(req, res, next) {
debug(`body = ${JSON.stringify(req.body, null, 2)}`)
debug(`actorId = ${req.body.actor}`)
// const result = await saveActorId(req.body.actor)
switch (req.body.type) {
- case 'Create':
- await activityPub.handleCreateActivity(req.body).catch(next)
- break
- case 'Undo':
- await activityPub.handleUndoActivity(req.body).catch(next)
- break
- case 'Follow':
- await activityPub.handleFollowActivity(req.body).catch(next)
- break
- case 'Delete':
- await activityPub.handleDeleteActivity(req.body).catch(next)
- break
- /* eslint-disable */
+ case 'Create':
+ await activityPub.handleCreateActivity(req.body).catch(next)
+ break
+ case 'Undo':
+ await activityPub.handleUndoActivity(req.body).catch(next)
+ break
+ case 'Follow':
+ await activityPub.handleFollowActivity(req.body).catch(next)
+ break
+ case 'Delete':
+ await activityPub.handleDeleteActivity(req.body).catch(next)
+ break
+ /* eslint-disable */
case 'Update':
await activityPub.handleUpdateActivity(req.body).catch(next)
break
diff --git a/backend/src/activitypub/routes/verify.js b/backend/src/activitypub/routes/verify.js
index bb5850b3e..33603805f 100644
--- a/backend/src/activitypub/routes/verify.js
+++ b/backend/src/activitypub/routes/verify.js
@@ -4,7 +4,12 @@ const debug = require('debug')('ea:verify')
export default async (req, res, next) => {
debug(`actorId = ${req.body.actor}`)
// TODO stop if signature validation fails
- if (await verifySignature(`${req.protocol}://${req.hostname}:${req.app.get('port')}${req.originalUrl}`, req.headers)) {
+ if (
+ await verifySignature(
+ `${req.protocol}://${req.hostname}:${req.app.get('port')}${req.originalUrl}`,
+ req.headers,
+ )
+ ) {
debug('verify = true')
next()
} else {
diff --git a/backend/src/activitypub/routes/webFinger.js b/backend/src/activitypub/routes/webFinger.js
index 8def32328..7d52c69cd 100644
--- a/backend/src/activitypub/routes/webFinger.js
+++ b/backend/src/activitypub/routes/webFinger.js
@@ -4,10 +4,14 @@ import gql from 'graphql-tag'
const router = express.Router()
-router.get('/', async function (req, res) {
+router.get('/', async function(req, res) {
const resource = req.query.resource
if (!resource || !resource.includes('acct:')) {
- return res.status(400).send('Bad request. Please make sure "acct:USER@DOMAIN" is what you are sending as the "resource" query parameter.')
+ return res
+ .status(400)
+ .send(
+ 'Bad request. Please make sure "acct:USER@DOMAIN" is what you are sending as the "resource" query parameter.',
+ )
} else {
const nameAndDomain = resource.replace('acct:', '')
const name = nameAndDomain.split('@')[0]
@@ -21,7 +25,7 @@ router.get('/', async function (req, res) {
slug
}
}
- `
+ `,
})
} catch (error) {
return res.status(500).json({ error })
diff --git a/backend/src/activitypub/security/httpSignature.spec.js b/backend/src/activitypub/security/httpSignature.spec.js
index d40c38242..0c6fbb8b5 100644
--- a/backend/src/activitypub/security/httpSignature.spec.js
+++ b/backend/src/activitypub/security/httpSignature.spec.js
@@ -14,9 +14,9 @@ describe('activityPub/security', () => {
privateKey = pair.privateKey
publicKey = pair.publicKey
headers = {
- 'Date': '2019-03-08T14:35:45.759Z',
- 'Host': 'democracy-app.de',
- 'Content-Type': 'application/json'
+ Date: '2019-03-08T14:35:45.759Z',
+ Host: 'democracy-app.de',
+ 'Content-Type': 'application/json',
}
})
@@ -27,13 +27,23 @@ describe('activityPub/security', () => {
beforeEach(() => {
const signer = crypto.createSign('rsa-sha256')
- signer.update('(request-target): post /activitypub/users/max/inbox\ndate: 2019-03-08T14:35:45.759Z\nhost: democracy-app.de\ncontent-type: application/json')
+ signer.update(
+ '(request-target): post /activitypub/users/max/inbox\ndate: 2019-03-08T14:35:45.759Z\nhost: democracy-app.de\ncontent-type: application/json',
+ )
signatureB64 = signer.sign({ key: privateKey, passphrase }, 'base64')
- httpSignature = createSignature({ privateKey, keyId: 'https://human-connection.org/activitypub/users/lea#main-key', url: 'https://democracy-app.de/activitypub/users/max/inbox', headers, passphrase })
+ httpSignature = createSignature({
+ privateKey,
+ keyId: 'https://human-connection.org/activitypub/users/lea#main-key',
+ url: 'https://democracy-app.de/activitypub/users/max/inbox',
+ headers,
+ passphrase,
+ })
})
it('contains keyId', () => {
- expect(httpSignature).toContain('keyId="https://human-connection.org/activitypub/users/lea#main-key"')
+ expect(httpSignature).toContain(
+ 'keyId="https://human-connection.org/activitypub/users/lea#main-key"',
+ )
})
it('contains default algorithm "rsa-sha256"', () => {
@@ -54,13 +64,19 @@ describe('activityPub/security', () => {
let httpSignature
beforeEach(() => {
- httpSignature = createSignature({ privateKey, keyId: 'http://localhost:4001/activitypub/users/test-user#main-key', url: 'https://democracy-app.de/activitypub/users/max/inbox', headers, passphrase })
+ httpSignature = createSignature({
+ privateKey,
+ keyId: 'http://localhost:4001/activitypub/users/test-user#main-key',
+ url: 'https://democracy-app.de/activitypub/users/max/inbox',
+ headers,
+ passphrase,
+ })
const body = {
- 'publicKey': {
- 'id': 'https://localhost:4001/activitypub/users/test-user#main-key',
- 'owner': 'https://localhost:4001/activitypub/users/test-user',
- 'publicKeyPem': publicKey
- }
+ publicKey: {
+ id: 'https://localhost:4001/activitypub/users/test-user#main-key',
+ owner: 'https://localhost:4001/activitypub/users/test-user',
+ publicKeyPem: publicKey,
+ },
}
const mockedRequest = jest.fn((_, callback) => callback(null, null, JSON.stringify(body)))
@@ -68,7 +84,9 @@ describe('activityPub/security', () => {
})
it('resolves false', async () => {
- await expect(verifySignature('https://democracy-app.de/activitypub/users/max/inbox', headers)).resolves.toEqual(false)
+ await expect(
+ verifySignature('https://democracy-app.de/activitypub/users/max/inbox', headers),
+ ).resolves.toEqual(false)
})
describe('valid signature', () => {
@@ -77,7 +95,9 @@ describe('activityPub/security', () => {
})
it('resolves true', async () => {
- await expect(verifySignature('https://democracy-app.de/activitypub/users/max/inbox', headers)).resolves.toEqual(true)
+ await expect(
+ verifySignature('https://democracy-app.de/activitypub/users/max/inbox', headers),
+ ).resolves.toEqual(true)
})
})
})
diff --git a/backend/src/activitypub/security/index.js b/backend/src/activitypub/security/index.js
index fdb1e27c6..7f619acbe 100644
--- a/backend/src/activitypub/security/index.js
+++ b/backend/src/activitypub/security/index.js
@@ -6,42 +6,48 @@ const debug = require('debug')('ea:security')
dotenv.config({ path: resolve('src', 'activitypub', '.env') })
-export function generateRsaKeyPair (options = {}) {
+export function generateRsaKeyPair(options = {}) {
const { passphrase = process.env.PRIVATE_KEY_PASSPHRASE } = options
return crypto.generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
- format: 'pem'
+ format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
- passphrase
- }
+ passphrase,
+ },
})
}
// signing
-export function createSignature (options) {
+export function createSignature(options) {
const {
- privateKey, keyId, url,
+ privateKey,
+ keyId,
+ url,
headers = {},
algorithm = 'rsa-sha256',
- passphrase = process.env.PRIVATE_KEY_PASSPHRASE
+ passphrase = process.env.PRIVATE_KEY_PASSPHRASE,
} = options
- if (!SUPPORTED_HASH_ALGORITHMS.includes(algorithm)) { throw Error(`SIGNING: Unsupported hashing algorithm = ${algorithm}`) }
+ if (!SUPPORTED_HASH_ALGORITHMS.includes(algorithm)) {
+ throw Error(`SIGNING: Unsupported hashing algorithm = ${algorithm}`)
+ }
const signer = crypto.createSign(algorithm)
const signingString = constructSigningString(url, headers)
signer.update(signingString)
const signatureB64 = signer.sign({ key: privateKey, passphrase }, 'base64')
- const headersString = Object.keys(headers).reduce((result, key) => { return result + ' ' + key.toLowerCase() }, '')
+ const headersString = Object.keys(headers).reduce((result, key) => {
+ return result + ' ' + key.toLowerCase()
+ }, '')
return `keyId="${keyId}",algorithm="${algorithm}",headers="(request-target)${headersString}",signature="${signatureB64}"`
}
// verifying
-export function verifySignature (url, headers) {
+export function verifySignature(url, headers) {
return new Promise((resolve, reject) => {
const signatureHeader = headers['signature'] ? headers['signature'] : headers['Signature']
if (!signatureHeader) {
@@ -61,40 +67,47 @@ export function verifySignature (url, headers) {
const usedHeaders = headersString.split(' ')
const verifyHeaders = {}
- Object.keys(headers).forEach((key) => {
+ Object.keys(headers).forEach(key => {
if (usedHeaders.includes(key.toLowerCase())) {
verifyHeaders[key.toLowerCase()] = headers[key]
}
})
const signingString = constructSigningString(url, verifyHeaders)
debug(`keyId= ${keyId}`)
- request({
- url: keyId,
- headers: {
- 'Accept': 'application/json'
- }
- }, (err, response, body) => {
- if (err) reject(err)
- debug(`body = ${body}`)
- const actor = JSON.parse(body)
- const publicKeyPem = actor.publicKey.publicKeyPem
- resolve(httpVerify(publicKeyPem, signature, signingString, algorithm))
- })
+ request(
+ {
+ url: keyId,
+ headers: {
+ Accept: 'application/json',
+ },
+ },
+ (err, response, body) => {
+ if (err) reject(err)
+ debug(`body = ${body}`)
+ const actor = JSON.parse(body)
+ const publicKeyPem = actor.publicKey.publicKeyPem
+ resolve(httpVerify(publicKeyPem, signature, signingString, algorithm))
+ },
+ )
})
}
// private: signing
-function constructSigningString (url, headers) {
+function constructSigningString(url, headers) {
const urlObj = new URL(url)
- let signingString = `(request-target): post ${urlObj.pathname}${urlObj.search !== '' ? urlObj.search : ''}`
+ let signingString = `(request-target): post ${urlObj.pathname}${
+ urlObj.search !== '' ? urlObj.search : ''
+ }`
return Object.keys(headers).reduce((result, key) => {
return result + `\n${key.toLowerCase()}: ${headers[key]}`
}, signingString)
}
// private: verifying
-function httpVerify (pubKey, signature, signingString, algorithm) {
- if (!SUPPORTED_HASH_ALGORITHMS.includes(algorithm)) { throw Error(`SIGNING: Unsupported hashing algorithm = ${algorithm}`) }
+function httpVerify(pubKey, signature, signingString, algorithm) {
+ if (!SUPPORTED_HASH_ALGORITHMS.includes(algorithm)) {
+ throw Error(`SIGNING: Unsupported hashing algorithm = ${algorithm}`)
+ }
const verifier = crypto.createVerify(algorithm)
verifier.update(signingString)
return verifier.verify(pubKey, signature, 'base64')
@@ -103,14 +116,16 @@ function httpVerify (pubKey, signature, signingString, algorithm) {
// private: verifying
// This function can be used to extract the signature,headers,algorithm etc. out of the Signature Header.
// Just pass what you want as key
-function extractKeyValueFromSignatureHeader (signatureHeader, key) {
- const keyString = signatureHeader.split(',').filter((el) => {
+function extractKeyValueFromSignatureHeader(signatureHeader, key) {
+ const keyString = signatureHeader.split(',').filter(el => {
return !!el.startsWith(key)
})[0]
let firstEqualIndex = keyString.search('=')
// When headers are requested add 17 to the index to remove "(request-target) " from the string
- if (key === 'headers') { firstEqualIndex += 17 }
+ if (key === 'headers') {
+ firstEqualIndex += 17
+ }
return keyString.substring(firstEqualIndex + 2, keyString.length - 1)
}
@@ -151,4 +166,5 @@ export const SUPPORTED_HASH_ALGORITHMS = [
'sha512WithRSAEncryption',
'ssl3-md5',
'ssl3-sha1',
- 'whirlpool']
+ 'whirlpool',
+]
diff --git a/backend/src/activitypub/utils/activity.js b/backend/src/activitypub/utils/activity.js
index 57b6dfb83..baf13e1bf 100644
--- a/backend/src/activitypub/utils/activity.js
+++ b/backend/src/activitypub/utils/activity.js
@@ -6,45 +6,45 @@ import as from 'activitystrea.ms'
import gql from 'graphql-tag'
const debug = require('debug')('ea:utils:activity')
-export function createNoteObject (text, name, id, published) {
+export function createNoteObject(text, name, id, published) {
const createUuid = crypto.randomBytes(16).toString('hex')
return {
'@context': 'https://www.w3.org/ns/activitystreams',
- 'id': `${activityPub.endpoint}/activitypub/users/${name}/status/${createUuid}`,
- 'type': 'Create',
- 'actor': `${activityPub.endpoint}/activitypub/users/${name}`,
- 'object': {
- 'id': `${activityPub.endpoint}/activitypub/users/${name}/status/${id}`,
- 'type': 'Note',
- 'published': published,
- 'attributedTo': `${activityPub.endpoint}/activitypub/users/${name}`,
- 'content': text,
- 'to': 'https://www.w3.org/ns/activitystreams#Public'
- }
+ id: `${activityPub.endpoint}/activitypub/users/${name}/status/${createUuid}`,
+ type: 'Create',
+ actor: `${activityPub.endpoint}/activitypub/users/${name}`,
+ object: {
+ id: `${activityPub.endpoint}/activitypub/users/${name}/status/${id}`,
+ type: 'Note',
+ published: published,
+ attributedTo: `${activityPub.endpoint}/activitypub/users/${name}`,
+ content: text,
+ to: 'https://www.w3.org/ns/activitystreams#Public',
+ },
}
}
-export async function createArticleObject (activityId, objectId, text, name, id, published) {
+export async function createArticleObject(activityId, objectId, text, name, id, published) {
const actorId = await getActorId(name)
return {
'@context': 'https://www.w3.org/ns/activitystreams',
- 'id': `${activityId}`,
- 'type': 'Create',
- 'actor': `${actorId}`,
- 'object': {
- 'id': `${objectId}`,
- 'type': 'Article',
- 'published': published,
- 'attributedTo': `${actorId}`,
- 'content': text,
- 'to': 'https://www.w3.org/ns/activitystreams#Public'
- }
+ id: `${activityId}`,
+ type: 'Create',
+ actor: `${actorId}`,
+ object: {
+ id: `${objectId}`,
+ type: 'Article',
+ published: published,
+ attributedTo: `${actorId}`,
+ content: text,
+ to: 'https://www.w3.org/ns/activitystreams#Public',
+ },
}
}
-export async function getActorId (name) {
+export async function getActorId(name) {
const result = await activityPub.dataSource.client.query({
query: gql`
query {
@@ -52,7 +52,7 @@ export async function getActorId (name) {
actorId
}
}
- `
+ `,
})
throwErrorIfApolloErrorOccurred(result)
if (Array.isArray(result.data.User) && result.data.User[0]) {
@@ -62,9 +62,12 @@ export async function getActorId (name) {
}
}
-export function sendAcceptActivity (theBody, name, targetDomain, url) {
+export function sendAcceptActivity(theBody, name, targetDomain, url) {
as.accept()
- .id(`${activityPub.endpoint}/activitypub/users/${name}/status/` + crypto.randomBytes(16).toString('hex'))
+ .id(
+ `${activityPub.endpoint}/activitypub/users/${name}/status/` +
+ crypto.randomBytes(16).toString('hex'),
+ )
.actor(`${activityPub.endpoint}/activitypub/users/${name}`)
.object(theBody)
.prettyWrite((err, doc) => {
@@ -77,9 +80,12 @@ export function sendAcceptActivity (theBody, name, targetDomain, url) {
})
}
-export function sendRejectActivity (theBody, name, targetDomain, url) {
+export function sendRejectActivity(theBody, name, targetDomain, url) {
as.reject()
- .id(`${activityPub.endpoint}/activitypub/users/${name}/status/` + crypto.randomBytes(16).toString('hex'))
+ .id(
+ `${activityPub.endpoint}/activitypub/users/${name}/status/` +
+ crypto.randomBytes(16).toString('hex'),
+ )
.actor(`${activityPub.endpoint}/activitypub/users/${name}`)
.object(theBody)
.prettyWrite((err, doc) => {
@@ -92,7 +98,7 @@ export function sendRejectActivity (theBody, name, targetDomain, url) {
})
}
-export function isPublicAddressed (postObject) {
+export function isPublicAddressed(postObject) {
if (typeof postObject.to === 'string') {
postObject.to = [postObject.to]
}
@@ -102,7 +108,9 @@ export function isPublicAddressed (postObject) {
if (Array.isArray(postObject)) {
postObject.to = postObject
}
- return postObject.to.includes('Public') ||
+ return (
+ postObject.to.includes('Public') ||
postObject.to.includes('as:Public') ||
postObject.to.includes('https://www.w3.org/ns/activitystreams#Public')
+ )
}
diff --git a/backend/src/activitypub/utils/actor.js b/backend/src/activitypub/utils/actor.js
index 27612517b..a08065778 100644
--- a/backend/src/activitypub/utils/actor.js
+++ b/backend/src/activitypub/utils/actor.js
@@ -1,41 +1,38 @@
import { activityPub } from '../ActivityPub'
-export function createActor (name, pubkey) {
+export function createActor(name, pubkey) {
return {
- '@context': [
- 'https://www.w3.org/ns/activitystreams',
- 'https://w3id.org/security/v1'
- ],
- 'id': `${activityPub.endpoint}/activitypub/users/${name}`,
- 'type': 'Person',
- 'preferredUsername': `${name}`,
- 'name': `${name}`,
- 'following': `${activityPub.endpoint}/activitypub/users/${name}/following`,
- 'followers': `${activityPub.endpoint}/activitypub/users/${name}/followers`,
- 'inbox': `${activityPub.endpoint}/activitypub/users/${name}/inbox`,
- 'outbox': `${activityPub.endpoint}/activitypub/users/${name}/outbox`,
- 'url': `${activityPub.endpoint}/activitypub/@${name}`,
- 'endpoints': {
- 'sharedInbox': `${activityPub.endpoint}/activitypub/inbox`
+ '@context': ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1'],
+ id: `${activityPub.endpoint}/activitypub/users/${name}`,
+ type: 'Person',
+ preferredUsername: `${name}`,
+ name: `${name}`,
+ following: `${activityPub.endpoint}/activitypub/users/${name}/following`,
+ followers: `${activityPub.endpoint}/activitypub/users/${name}/followers`,
+ inbox: `${activityPub.endpoint}/activitypub/users/${name}/inbox`,
+ outbox: `${activityPub.endpoint}/activitypub/users/${name}/outbox`,
+ url: `${activityPub.endpoint}/activitypub/@${name}`,
+ endpoints: {
+ sharedInbox: `${activityPub.endpoint}/activitypub/inbox`,
+ },
+ publicKey: {
+ id: `${activityPub.endpoint}/activitypub/users/${name}#main-key`,
+ owner: `${activityPub.endpoint}/activitypub/users/${name}`,
+ publicKeyPem: pubkey,
},
- 'publicKey': {
- 'id': `${activityPub.endpoint}/activitypub/users/${name}#main-key`,
- 'owner': `${activityPub.endpoint}/activitypub/users/${name}`,
- 'publicKeyPem': pubkey
- }
}
}
-export function createWebFinger (name) {
+export function createWebFinger(name) {
const { host } = new URL(activityPub.endpoint)
return {
- 'subject': `acct:${name}@${host}`,
- 'links': [
+ subject: `acct:${name}@${host}`,
+ links: [
{
- 'rel': 'self',
- 'type': 'application/activity+json',
- 'href': `${activityPub.endpoint}/activitypub/users/${name}`
- }
- ]
+ rel: 'self',
+ type: 'application/activity+json',
+ href: `${activityPub.endpoint}/activitypub/users/${name}`,
+ },
+ ],
}
}
diff --git a/backend/src/activitypub/utils/collection.js b/backend/src/activitypub/utils/collection.js
index e3a63c74d..29cf69ac2 100644
--- a/backend/src/activitypub/utils/collection.js
+++ b/backend/src/activitypub/utils/collection.js
@@ -2,68 +2,71 @@ import { activityPub } from '../ActivityPub'
import { constructIdFromName } from './index'
const debug = require('debug')('ea:utils:collections')
-export function createOrderedCollection (name, collectionName) {
+export function createOrderedCollection(name, collectionName) {
return {
'@context': 'https://www.w3.org/ns/activitystreams',
- 'id': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}`,
- 'summary': `${name}s ${collectionName} collection`,
- 'type': 'OrderedCollection',
- 'first': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}?page=true`,
- 'totalItems': 0
+ id: `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}`,
+ summary: `${name}s ${collectionName} collection`,
+ type: 'OrderedCollection',
+ first: `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}?page=true`,
+ totalItems: 0,
}
}
-export function createOrderedCollectionPage (name, collectionName) {
+export function createOrderedCollectionPage(name, collectionName) {
return {
'@context': 'https://www.w3.org/ns/activitystreams',
- 'id': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}?page=true`,
- 'summary': `${name}s ${collectionName} collection`,
- 'type': 'OrderedCollectionPage',
- 'totalItems': 0,
- 'partOf': `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}`,
- 'orderedItems': []
+ id: `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}?page=true`,
+ summary: `${name}s ${collectionName} collection`,
+ type: 'OrderedCollectionPage',
+ totalItems: 0,
+ partOf: `${activityPub.endpoint}/activitypub/users/${name}/${collectionName}`,
+ orderedItems: [],
}
}
-export function sendCollection (collectionName, req, res) {
+export function sendCollection(collectionName, req, res) {
const name = req.params.name
const id = constructIdFromName(name)
switch (collectionName) {
- case 'followers':
- attachThenCatch(activityPub.collections.getFollowersCollection(id), res)
- break
+ case 'followers':
+ attachThenCatch(activityPub.collections.getFollowersCollection(id), res)
+ break
- case 'followersPage':
- attachThenCatch(activityPub.collections.getFollowersCollectionPage(id), res)
- break
+ case 'followersPage':
+ attachThenCatch(activityPub.collections.getFollowersCollectionPage(id), res)
+ break
- case 'following':
- attachThenCatch(activityPub.collections.getFollowingCollection(id), res)
- break
+ case 'following':
+ attachThenCatch(activityPub.collections.getFollowingCollection(id), res)
+ break
- case 'followingPage':
- attachThenCatch(activityPub.collections.getFollowingCollectionPage(id), res)
- break
+ case 'followingPage':
+ attachThenCatch(activityPub.collections.getFollowingCollectionPage(id), res)
+ break
- case 'outbox':
- attachThenCatch(activityPub.collections.getOutboxCollection(id), res)
- break
+ case 'outbox':
+ attachThenCatch(activityPub.collections.getOutboxCollection(id), res)
+ break
- case 'outboxPage':
- attachThenCatch(activityPub.collections.getOutboxCollectionPage(id), res)
- break
+ case 'outboxPage':
+ attachThenCatch(activityPub.collections.getOutboxCollectionPage(id), res)
+ break
- default:
- res.status(500).end()
+ default:
+ res.status(500).end()
}
}
-function attachThenCatch (promise, res) {
+function attachThenCatch(promise, res) {
return promise
- .then((collection) => {
- res.status(200).contentType('application/activity+json').send(collection)
+ .then(collection => {
+ res
+ .status(200)
+ .contentType('application/activity+json')
+ .send(collection)
})
- .catch((err) => {
+ .catch(err => {
debug(`error getting a Collection: = ${err}`)
res.status(500).end()
})
diff --git a/backend/src/activitypub/utils/index.js b/backend/src/activitypub/utils/index.js
index a83dcc829..ee7ae2606 100644
--- a/backend/src/activitypub/utils/index.js
+++ b/backend/src/activitypub/utils/index.js
@@ -4,7 +4,7 @@ import { createSignature } from '../security'
import request from 'request'
const debug = require('debug')('ea:utils')
-export function extractNameFromId (uri) {
+export function extractNameFromId(uri) {
const urlObject = new URL(uri)
const pathname = urlObject.pathname
const splitted = pathname.split('/')
@@ -12,28 +12,30 @@ export function extractNameFromId (uri) {
return splitted[splitted.indexOf('users') + 1]
}
-export function extractIdFromActivityId (uri) {
+export function extractIdFromActivityId(uri) {
const urlObject = new URL(uri)
const pathname = urlObject.pathname
const splitted = pathname.split('/')
return splitted[splitted.indexOf('status') + 1]
}
-export function constructIdFromName (name, fromDomain = activityPub.endpoint) {
+export function constructIdFromName(name, fromDomain = activityPub.endpoint) {
return `${fromDomain}/activitypub/users/${name}`
}
-export function extractDomainFromUrl (url) {
+export function extractDomainFromUrl(url) {
return new URL(url).host
}
-export function throwErrorIfApolloErrorOccurred (result) {
+export function throwErrorIfApolloErrorOccurred(result) {
if (result.error && (result.error.message || result.error.errors)) {
- throw new Error(`${result.error.message ? result.error.message : result.error.errors[0].message}`)
+ throw new Error(
+ `${result.error.message ? result.error.message : result.error.errors[0].message}`,
+ )
}
}
-export function signAndSend (activity, fromName, targetDomain, url) {
+export function signAndSend(activity, fromName, targetDomain, url) {
// fix for development: replace with http
url = url.indexOf('localhost') > -1 ? url.replace('https', 'http') : url
debug(`passhprase = ${process.env.PRIVATE_KEY_PASSPHRASE}`)
@@ -47,7 +49,7 @@ export function signAndSend (activity, fromName, targetDomain, url) {
privateKey
}
}
- `
+ `,
})
if (result.error) {
@@ -69,34 +71,38 @@ export function signAndSend (activity, fromName, targetDomain, url) {
const date = new Date().toUTCString()
debug(`url = ${url}`)
- request({
- url: url,
- headers: {
- 'Host': targetDomain,
- 'Date': date,
- 'Signature': createSignature({ privateKey,
- keyId: `${activityPub.endpoint}/activitypub/users/${fromName}#main-key`,
- url,
- headers: {
- 'Host': targetDomain,
- 'Date': date,
- 'Content-Type': 'application/activity+json'
- }
- }),
- 'Content-Type': 'application/activity+json'
+ request(
+ {
+ url: url,
+ headers: {
+ Host: targetDomain,
+ Date: date,
+ Signature: createSignature({
+ privateKey,
+ keyId: `${activityPub.endpoint}/activitypub/users/${fromName}#main-key`,
+ url,
+ headers: {
+ Host: targetDomain,
+ Date: date,
+ 'Content-Type': 'application/activity+json',
+ },
+ }),
+ 'Content-Type': 'application/activity+json',
+ },
+ method: 'POST',
+ body: JSON.stringify(parsedActivity),
},
- method: 'POST',
- body: JSON.stringify(parsedActivity)
- }, (error, response) => {
- if (error) {
- debug(`Error = ${JSON.stringify(error, null, 2)}`)
- reject(error)
- } else {
- debug('Response Headers:', JSON.stringify(response.headers, null, 2))
- debug('Response Body:', JSON.stringify(response.body, null, 2))
- resolve()
- }
- })
+ (error, response) => {
+ if (error) {
+ debug(`Error = ${JSON.stringify(error, null, 2)}`)
+ reject(error)
+ } else {
+ debug('Response Headers:', JSON.stringify(response.headers, null, 2))
+ debug('Response Body:', JSON.stringify(response.body, null, 2))
+ resolve()
+ }
+ },
+ )
}
})
}
diff --git a/backend/src/bootstrap/directives.js b/backend/src/bootstrap/directives.js
index 8c392ed46..93a7574fb 100644
--- a/backend/src/bootstrap/directives.js
+++ b/backend/src/bootstrap/directives.js
@@ -1,15 +1,11 @@
import {
GraphQLLowerCaseDirective,
GraphQLTrimDirective,
- GraphQLDefaultToDirective
+ GraphQLDefaultToDirective,
} from 'graphql-custom-directives'
-export default function applyDirectives (augmentedSchema) {
- const directives = [
- GraphQLLowerCaseDirective,
- GraphQLTrimDirective,
- GraphQLDefaultToDirective
- ]
+export default function applyDirectives(augmentedSchema) {
+ const directives = [GraphQLLowerCaseDirective, GraphQLTrimDirective, GraphQLDefaultToDirective]
augmentedSchema._directives.push.apply(augmentedSchema._directives, directives)
return augmentedSchema
diff --git a/backend/src/bootstrap/neo4j.js b/backend/src/bootstrap/neo4j.js
index 935449a0a..292983359 100644
--- a/backend/src/bootstrap/neo4j.js
+++ b/backend/src/bootstrap/neo4j.js
@@ -5,11 +5,11 @@ dotenv.config()
let driver
-export function getDriver (options = {}) {
+export function getDriver(options = {}) {
const {
uri = process.env.NEO4J_URI || 'bolt://localhost:7687',
username = process.env.NEO4J_USERNAME || 'neo4j',
- password = process.env.NEO4J_PASSWORD || 'neo4j'
+ password = process.env.NEO4J_PASSWORD || 'neo4j',
} = options
if (!driver) {
driver = neo4j.driver(uri, neo4j.auth.basic(username, password))
diff --git a/backend/src/bootstrap/scalars.js b/backend/src/bootstrap/scalars.js
index 813bd5051..eb6d3739b 100644
--- a/backend/src/bootstrap/scalars.js
+++ b/backend/src/bootstrap/scalars.js
@@ -1,10 +1,6 @@
-import {
- GraphQLDate,
- GraphQLTime,
- GraphQLDateTime
-} from 'graphql-iso-date'
+import { GraphQLDate, GraphQLTime, GraphQLDateTime } from 'graphql-iso-date'
-export default function applyScalars (augmentedSchema) {
+export default function applyScalars(augmentedSchema) {
augmentedSchema._typeMap.Date = GraphQLDate
augmentedSchema._typeMap.Time = GraphQLTime
augmentedSchema._typeMap.DateTime = GraphQLDateTime
diff --git a/backend/src/graphql-schema.js b/backend/src/graphql-schema.js
index bad277721..0942b2381 100644
--- a/backend/src/graphql-schema.js
+++ b/backend/src/graphql-schema.js
@@ -14,9 +14,7 @@ import notifications from './resolvers/notifications'
import comments from './resolvers/comments'
export const typeDefs = fs
- .readFileSync(
- process.env.GRAPHQL_SCHEMA || path.join(__dirname, 'schema.graphql')
- )
+ .readFileSync(process.env.GRAPHQL_SCHEMA || path.join(__dirname, 'schema.graphql'))
.toString('utf-8')
export const resolvers = {
@@ -24,7 +22,7 @@ export const resolvers = {
...statistics.Query,
...userManagement.Query,
...notifications.Query,
- ...comments.Query
+ ...comments.Query,
},
Mutation: {
...userManagement.Mutation,
@@ -36,6 +34,6 @@ export const resolvers = {
...rewards.Mutation,
...socialMedia.Mutation,
...notifications.Mutation,
- ...comments.Mutation
- }
+ ...comments.Mutation,
+ },
}
diff --git a/backend/src/helpers/asyncForEach.js b/backend/src/helpers/asyncForEach.js
index 1f05ea915..5577cce14 100644
--- a/backend/src/helpers/asyncForEach.js
+++ b/backend/src/helpers/asyncForEach.js
@@ -5,7 +5,7 @@
* @param callback
* @returns {Promise}
*/
-async function asyncForEach (array, callback) {
+async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
diff --git a/backend/src/helpers/walkRecursive.js b/backend/src/helpers/walkRecursive.js
index 2f60de2a4..db9a4c703 100644
--- a/backend/src/helpers/walkRecursive.js
+++ b/backend/src/helpers/walkRecursive.js
@@ -1,10 +1,10 @@
/**
- * iterate through all fields and replace it with the callback result
- * @property data Array
- * @property fields Array
- * @property callback Function
- */
-function walkRecursive (data, fields, callback, _key) {
+ * iterate through all fields and replace it with the callback result
+ * @property data Array
+ * @property fields Array
+ * @property callback Function
+ */
+function walkRecursive(data, fields, callback, _key) {
if (!Array.isArray(fields)) {
throw new Error('please provide an fields array for the walkRecursive helper')
}
diff --git a/backend/src/index.js b/backend/src/index.js
index 843639aa8..2095d171f 100644
--- a/backend/src/index.js
+++ b/backend/src/index.js
@@ -2,7 +2,7 @@ import createServer from './server'
import ActivityPub from './activitypub/ActivityPub'
const serverConfig = {
- port: process.env.GRAPHQL_PORT || 4000
+ port: process.env.GRAPHQL_PORT || 4000,
// cors: {
// credentials: true,
// origin: [process.env.CLIENT_URI] // your frontend url.
diff --git a/backend/src/jest/helpers.js b/backend/src/jest/helpers.js
index 0d358ed40..d07bc9ad1 100644
--- a/backend/src/jest/helpers.js
+++ b/backend/src/jest/helpers.js
@@ -4,13 +4,13 @@ import { request } from 'graphql-request'
// not to be confused with the seeder host
export const host = 'http://127.0.0.1:4123'
-export async function login ({ email, password }) {
+export async function login({ email, password }) {
const mutation = `
mutation {
login(email:"${email}", password:"${password}")
}`
const response = await request(host, mutation)
return {
- authorization: `Bearer ${response.login}`
+ authorization: `Bearer ${response.login}`,
}
}
diff --git a/backend/src/jwt/decode.js b/backend/src/jwt/decode.js
index e8305a83b..d4485952d 100644
--- a/backend/src/jwt/decode.js
+++ b/backend/src/jwt/decode.js
@@ -7,7 +7,7 @@ export default async (driver, authorizationHeader) => {
try {
const decoded = await jwt.verify(token, process.env.JWT_SECRET)
id = decoded.sub
- } catch {
+ } catch (err) {
return null
}
const session = driver.session()
@@ -18,13 +18,13 @@ export default async (driver, authorizationHeader) => {
`
const result = await session.run(query, { id })
session.close()
- const [currentUser] = await result.records.map((record) => {
+ const [currentUser] = await result.records.map(record => {
return record.get('user')
})
if (!currentUser) return null
if (currentUser.disabled) return null
return {
token,
- ...currentUser
+ ...currentUser,
}
}
diff --git a/backend/src/jwt/encode.js b/backend/src/jwt/encode.js
index f32fc12da..49aa17bd0 100644
--- a/backend/src/jwt/encode.js
+++ b/backend/src/jwt/encode.js
@@ -1,14 +1,13 @@
-
import jwt from 'jsonwebtoken'
import ms from 'ms'
// Generate an Access Token for the given User ID
-export default function encode (user) {
+export default function encode(user) {
const token = jwt.sign(user, process.env.JWT_SECRET, {
expiresIn: ms('1d'),
issuer: process.env.GRAPHQL_URI,
audience: process.env.CLIENT_URI,
- subject: user.id.toString()
+ subject: user.id.toString(),
})
// jwt.verifySignature(token, process.env.JWT_SECRET, (err, data) => {
// console.log('token verification:', err, data)
diff --git a/backend/src/middleware/activityPubMiddleware.js b/backend/src/middleware/activityPubMiddleware.js
index dcb5ae93c..43da21e26 100644
--- a/backend/src/middleware/activityPubMiddleware.js
+++ b/backend/src/middleware/activityPubMiddleware.js
@@ -22,13 +22,15 @@ export default {
.id(`${actorId}/status/${args.activityId}`)
.actor(`${actorId}`)
.object(
- as.article()
+ as
+ .article()
.id(`${actorId}/status/${post.id}`)
.content(post.content)
.to('https://www.w3.org/ns/activitystreams#Public')
.publishedNow()
- .attributedTo(`${actorId}`)
- ).prettyWrite((err, doc) => {
+ .attributedTo(`${actorId}`),
+ )
+ .prettyWrite((err, doc) => {
if (err) {
reject(err)
} else {
@@ -51,6 +53,6 @@ export default {
Object.assign(args, keys)
args.actorId = `${activityPub.host}/activitypub/users/${args.slug}`
return resolve(root, args, context, info)
- }
- }
+ },
+ },
}
diff --git a/backend/src/middleware/dateTimeMiddleware.js b/backend/src/middleware/dateTimeMiddleware.js
index 11b6498a4..ac6e0ac4a 100644
--- a/backend/src/middleware/dateTimeMiddleware.js
+++ b/backend/src/middleware/dateTimeMiddleware.js
@@ -1,9 +1,9 @@
const setCreatedAt = (resolve, root, args, context, info) => {
- args.createdAt = (new Date()).toISOString()
+ args.createdAt = new Date().toISOString()
return resolve(root, args, context, info)
}
const setUpdatedAt = (resolve, root, args, context, info) => {
- args.updatedAt = (new Date()).toISOString()
+ args.updatedAt = new Date().toISOString()
return resolve(root, args, context, info)
}
@@ -18,6 +18,6 @@ export default {
UpdatePost: setUpdatedAt,
UpdateComment: setUpdatedAt,
UpdateOrganization: setUpdatedAt,
- UpdateNotification: setUpdatedAt
- }
+ UpdateNotification: setUpdatedAt,
+ },
}
diff --git a/backend/src/middleware/excerptMiddleware.js b/backend/src/middleware/excerptMiddleware.js
index 544dc3529..3b3a27c2c 100644
--- a/backend/src/middleware/excerptMiddleware.js
+++ b/backend/src/middleware/excerptMiddleware.js
@@ -31,6 +31,6 @@ export default {
args.descriptionExcerpt = trunc(args.description, 120).html
const result = await resolve(root, args, context, info)
return result
- }
- }
+ },
+ },
}
diff --git a/backend/src/middleware/fixImageUrlsMiddleware.js b/backend/src/middleware/fixImageUrlsMiddleware.js
index e5dc47a6d..c930915bf 100644
--- a/backend/src/middleware/fixImageUrlsMiddleware.js
+++ b/backend/src/middleware/fixImageUrlsMiddleware.js
@@ -1,21 +1,24 @@
-
const legacyUrls = [
'https://api-alpha.human-connection.org',
'https://staging-api.human-connection.org',
- 'http://localhost:3000'
+ 'http://localhost:3000',
]
-export const fixUrl = (url) => {
- legacyUrls.forEach((legacyUrl) => {
+export const fixUrl = url => {
+ legacyUrls.forEach(legacyUrl => {
url = url.replace(legacyUrl, '/api')
})
return url
}
-const checkUrl = (thing) => {
- return thing && typeof thing === 'string' && legacyUrls.find((legacyUrl) => {
- return thing.indexOf(legacyUrl) === 0
- })
+const checkUrl = thing => {
+ return (
+ thing &&
+ typeof thing === 'string' &&
+ legacyUrls.find(legacyUrl => {
+ return thing.indexOf(legacyUrl) === 0
+ })
+ )
}
export const fixImageURLs = (result, recursive) => {
@@ -41,5 +44,5 @@ export default {
Query: async (resolve, root, args, context, info) => {
let result = await resolve(root, args, context, info)
return fixImageURLs(result)
- }
+ },
}
diff --git a/backend/src/middleware/fixImageUrlsMiddleware.spec.js b/backend/src/middleware/fixImageUrlsMiddleware.spec.js
index 89d2a520d..b2d808dd9 100644
--- a/backend/src/middleware/fixImageUrlsMiddleware.spec.js
+++ b/backend/src/middleware/fixImageUrlsMiddleware.spec.js
@@ -3,15 +3,21 @@ import { fixImageURLs } from './fixImageUrlsMiddleware'
describe('fixImageURLs', () => {
describe('image url of legacy alpha', () => {
it('removes domain', () => {
- const url = 'https://api-alpha.human-connection.org/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png'
- expect(fixImageURLs(url)).toEqual('/api/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png')
+ const url =
+ 'https://api-alpha.human-connection.org/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png'
+ expect(fixImageURLs(url)).toEqual(
+ '/api/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png',
+ )
})
})
describe('image url of legacy staging', () => {
it('removes domain', () => {
- const url = 'https://staging-api.human-connection.org/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg'
- expect(fixImageURLs(url)).toEqual('/api/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg')
+ const url =
+ 'https://staging-api.human-connection.org/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg'
+ expect(fixImageURLs(url)).toEqual(
+ '/api/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg',
+ )
})
})
@@ -24,7 +30,7 @@ describe('fixImageURLs', () => {
describe('some string', () => {
it('returns untouched', () => {})
- const string = 'Yeah I\'m a String'
+ const string = "Yeah I'm a String"
expect(fixImageURLs(string)).toEqual(string)
})
})
diff --git a/backend/src/middleware/includedFieldsMiddleware.js b/backend/src/middleware/includedFieldsMiddleware.js
index 5dd63cd3c..cd7a74f4e 100644
--- a/backend/src/middleware/includedFieldsMiddleware.js
+++ b/backend/src/middleware/includedFieldsMiddleware.js
@@ -2,21 +2,21 @@ import cloneDeep from 'lodash/cloneDeep'
const _includeFieldsRecursively = (selectionSet, includedFields) => {
if (!selectionSet) return
- includedFields.forEach((includedField) => {
+ includedFields.forEach(includedField => {
selectionSet.selections.unshift({
kind: 'Field',
- name: { kind: 'Name', value: includedField }
+ name: { kind: 'Name', value: includedField },
})
})
- selectionSet.selections.forEach((selection) => {
+ selectionSet.selections.forEach(selection => {
_includeFieldsRecursively(selection.selectionSet, includedFields)
})
}
-const includeFieldsRecursively = (includedFields) => {
+const includeFieldsRecursively = includedFields => {
return (resolve, root, args, context, resolveInfo) => {
const copy = cloneDeep(resolveInfo)
- copy.fieldNodes.forEach((fieldNode) => {
+ copy.fieldNodes.forEach(fieldNode => {
_includeFieldsRecursively(fieldNode.selectionSet, includedFields)
})
return resolve(root, args, context, copy)
@@ -25,5 +25,5 @@ const includeFieldsRecursively = (includedFields) => {
export default {
Query: includeFieldsRecursively(['id', 'createdAt', 'disabled', 'deleted']),
- Mutation: includeFieldsRecursively(['id', 'createdAt', 'disabled', 'deleted'])
+ Mutation: includeFieldsRecursively(['id', 'createdAt', 'disabled', 'deleted']),
}
diff --git a/backend/src/middleware/index.js b/backend/src/middleware/index.js
index 17b9d63fb..bef6ceac9 100644
--- a/backend/src/middleware/index.js
+++ b/backend/src/middleware/index.js
@@ -26,7 +26,7 @@ export default schema => {
softDeleteMiddleware,
userMiddleware,
includedFieldsMiddleware,
- orderByMiddleware
+ orderByMiddleware,
]
// add permisions middleware at the first position (unless we're seeding)
@@ -35,7 +35,8 @@ export default schema => {
const DISABLED_MIDDLEWARES = process.env.DISABLED_MIDDLEWARES || ''
const disabled = DISABLED_MIDDLEWARES.split(',')
if (!disabled.includes('activityPub')) middleware.unshift(activityPubMiddleware)
- if (!disabled.includes('permissions')) middleware.unshift(permissionsMiddleware.generate(schema))
+ if (!disabled.includes('permissions'))
+ middleware.unshift(permissionsMiddleware.generate(schema))
}
return middleware
}
diff --git a/backend/src/middleware/nodes/locations.js b/backend/src/middleware/nodes/locations.js
index 735b047dd..a0adeb57f 100644
--- a/backend/src/middleware/nodes/locations.js
+++ b/backend/src/middleware/nodes/locations.js
@@ -1,4 +1,3 @@
-
import request from 'request'
import { UserInputError } from 'apollo-server'
import isEmpty from 'lodash/isEmpty'
@@ -6,7 +5,7 @@ import asyncForEach from '../../helpers/asyncForEach'
const fetch = url => {
return new Promise((resolve, reject) => {
- request(url, function (error, response, body) {
+ request(url, function(error, response, body) {
if (error) {
reject(error)
} else {
@@ -16,16 +15,7 @@ const fetch = url => {
})
}
-const locales = [
- 'en',
- 'de',
- 'fr',
- 'nl',
- 'it',
- 'es',
- 'pt',
- 'pl'
-]
+const locales = ['en', 'de', 'fr', 'nl', 'it', 'es', 'pt', 'pl']
const createLocation = async (session, mapboxData) => {
const data = {
@@ -39,21 +29,22 @@ const createLocation = async (session, mapboxData) => {
namePT: mapboxData.text_pt,
namePL: mapboxData.text_pl,
type: mapboxData.id.split('.')[0].toLowerCase(),
- lat: (mapboxData.center && mapboxData.center.length) ? mapboxData.center[0] : null,
- lng: (mapboxData.center && mapboxData.center.length) ? mapboxData.center[1] : null
+ lat: mapboxData.center && mapboxData.center.length ? mapboxData.center[0] : null,
+ lng: mapboxData.center && mapboxData.center.length ? mapboxData.center[1] : null,
}
- let query = 'MERGE (l:Location {id: $id}) ' +
- 'SET l.name = $nameEN, ' +
- 'l.nameEN = $nameEN, ' +
- 'l.nameDE = $nameDE, ' +
- 'l.nameFR = $nameFR, ' +
- 'l.nameNL = $nameNL, ' +
- 'l.nameIT = $nameIT, ' +
- 'l.nameES = $nameES, ' +
- 'l.namePT = $namePT, ' +
- 'l.namePL = $namePL, ' +
- 'l.type = $type'
+ let query =
+ 'MERGE (l:Location {id: $id}) ' +
+ 'SET l.name = $nameEN, ' +
+ 'l.nameEN = $nameEN, ' +
+ 'l.nameDE = $nameDE, ' +
+ 'l.nameFR = $nameFR, ' +
+ 'l.nameNL = $nameNL, ' +
+ 'l.nameIT = $nameIT, ' +
+ 'l.nameES = $nameES, ' +
+ 'l.namePT = $namePT, ' +
+ 'l.namePL = $namePL, ' +
+ 'l.type = $type'
if (data.lat && data.lng) {
query += ', l.lat = $lat, l.lng = $lng'
@@ -68,7 +59,11 @@ const createOrUpdateLocations = async (userId, locationName, driver) => {
return
}
const mapboxToken = process.env.MAPBOX_TOKEN
- const res = await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(locationName)}.json?access_token=${mapboxToken}&types=region,place,country&language=${locales.join(',')}`)
+ const res = await fetch(
+ `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(
+ locationName,
+ )}.json?access_token=${mapboxToken}&types=region,place,country&language=${locales.join(',')}`,
+ )
if (!res || !res.features || !res.features[0]) {
throw new UserInputError('locationName is invalid')
@@ -100,24 +95,29 @@ const createOrUpdateLocations = async (userId, locationName, driver) => {
await session.run(
'MATCH (parent:Location {id: $parentId}), (child:Location {id: $childId}) ' +
- 'MERGE (child)<-[:IS_IN]-(parent) ' +
- 'RETURN child.id, parent.id', {
+ 'MERGE (child)<-[:IS_IN]-(parent) ' +
+ 'RETURN child.id, parent.id',
+ {
parentId: parent.id,
- childId: ctx.id
- })
+ childId: ctx.id,
+ },
+ )
parent = ctx
})
}
// delete all current locations from user
await session.run('MATCH (u:User {id: $userId})-[r:IS_IN]->(l:Location) DETACH DELETE r', {
- userId: userId
+ userId: userId,
})
// connect user with location
- await session.run('MATCH (u:User {id: $userId}), (l:Location {id: $locationId}) MERGE (u)-[:IS_IN]->(l) RETURN l.id, u.id', {
- userId: userId,
- locationId: data.id
- })
+ await session.run(
+ 'MATCH (u:User {id: $userId}), (l:Location {id: $locationId}) MERGE (u)-[:IS_IN]->(l) RETURN l.id, u.id',
+ {
+ userId: userId,
+ locationId: data.id,
+ },
+ )
session.close()
}
diff --git a/backend/src/middleware/notifications/extractMentions.js b/backend/src/middleware/notifications/extractMentions.js
index f2b28444f..d6fa8ac3a 100644
--- a/backend/src/middleware/notifications/extractMentions.js
+++ b/backend/src/middleware/notifications/extractMentions.js
@@ -1,13 +1,15 @@
import cheerio from 'cheerio'
const ID_REGEX = /\/profile\/([\w\-.!~*'"(),]+)/g
-export default function (content) {
+export default function(content) {
const $ = cheerio.load(content)
- const urls = $('.mention').map((_, el) => {
- return $(el).attr('href')
- }).get()
+ const urls = $('.mention')
+ .map((_, el) => {
+ return $(el).attr('href')
+ })
+ .get()
const ids = []
- urls.forEach((url) => {
+ urls.forEach(url => {
let match
while ((match = ID_REGEX.exec(url)) != null) {
ids.push(match[1])
diff --git a/backend/src/middleware/notifications/extractMentions.spec.js b/backend/src/middleware/notifications/extractMentions.spec.js
index 625b1d8fe..d55c492ce 100644
--- a/backend/src/middleware/notifications/extractMentions.spec.js
+++ b/backend/src/middleware/notifications/extractMentions.spec.js
@@ -3,41 +3,48 @@ import extractIds from './extractMentions'
describe('extract', () => {
describe('searches through links', () => {
it('ignores links without .mention class', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual([])
})
describe('given a link with .mention class', () => {
it('extracts ids', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual(['u2', 'u3'])
})
describe('handles links', () => {
it('with slug and id', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual(['u2', 'u3'])
})
it('with domains', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual(['u2', 'u3'])
})
it('special characters', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual(['u!*(),2', 'u.~-3'])
})
})
describe('does not crash if', () => {
it('`href` contains no user id', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual([])
})
it('`href` is empty or invalid', () => {
- const content = 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
+ const content =
+ 'Something inspirational about @bob-der-baumeister and @jenny-rostock .
'
expect(extractIds(content)).toEqual([])
})
})
diff --git a/backend/src/middleware/notifications/index.js b/backend/src/middleware/notifications/index.js
index 942eb588d..866a4376a 100644
--- a/backend/src/middleware/notifications/index.js
+++ b/backend/src/middleware/notifications/index.js
@@ -8,7 +8,7 @@ const notify = async (resolve, root, args, context, resolveInfo) => {
const session = context.driver.session()
const { id: postId } = post
- const createdAt = (new Date()).toISOString()
+ const createdAt = new Date().toISOString()
const cypher = `
match(u:User) where u.id in $ids
match(p:Post) where p.id = $postId
@@ -25,6 +25,6 @@ const notify = async (resolve, root, args, context, resolveInfo) => {
export default {
Mutation: {
CreatePost: notify,
- UpdatePost: notify
- }
+ UpdatePost: notify,
+ },
}
diff --git a/backend/src/middleware/notifications/spec.js b/backend/src/middleware/notifications/spec.js
index 786ee7115..65212e544 100644
--- a/backend/src/middleware/notifications/spec.js
+++ b/backend/src/middleware/notifications/spec.js
@@ -11,7 +11,7 @@ beforeEach(async () => {
name: 'Al Capone',
slug: 'al-capone',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -47,7 +47,7 @@ describe('currentUser { notifications }', () => {
authorParams = {
email: 'author@example.org',
password: '1234',
- id: 'author'
+ id: 'author',
}
await factory.create('User', authorParams)
authorHeaders = await login(authorParams)
@@ -56,7 +56,8 @@ describe('currentUser { notifications }', () => {
describe('who mentions me in a post', () => {
let post
const title = 'Mentioning Al Capone'
- const content = 'Hey @al-capone how do you do?'
+ const content =
+ 'Hey @al-capone how do you do?'
beforeEach(async () => {
const createPostMutation = `
@@ -74,20 +75,21 @@ describe('currentUser { notifications }', () => {
})
it('sends you a notification', async () => {
- const expectedContent = 'Hey @al-capone how do you do?'
+ const expectedContent =
+ 'Hey @al-capone how do you do?'
const expected = {
currentUser: {
- notifications: [
- { read: false, post: { content: expectedContent } }
- ]
- }
+ notifications: [{ read: false, post: { content: expectedContent } }],
+ },
}
await expect(client.request(query, { read: false })).resolves.toEqual(expected)
})
describe('who mentions me again', () => {
beforeEach(async () => {
- const updatedContent = `${post.content} One more mention to @al-capone `
+ const updatedContent = `${
+ post.content
+ } One more mention to @al-capone `
// The response `post.content` contains a link but the XSSmiddleware
// should have the `mention` CSS class removed. I discovered this
// during development and thought: A feature not a bug! This way we
@@ -106,14 +108,15 @@ describe('currentUser { notifications }', () => {
})
it('creates exactly one more notification', async () => {
- const expectedContent = 'Hey @al-capone how do you do? One more mention to @al-capone '
+ const expectedContent =
+ 'Hey @al-capone how do you do? One more mention to @al-capone '
const expected = {
currentUser: {
notifications: [
{ read: false, post: { content: expectedContent } },
- { read: false, post: { content: expectedContent } }
- ]
- }
+ { read: false, post: { content: expectedContent } },
+ ],
+ },
}
await expect(client.request(query, { read: false })).resolves.toEqual(expected)
})
diff --git a/backend/src/middleware/orderByMiddleware.js b/backend/src/middleware/orderByMiddleware.js
index 5f8aabb9e..64eac8b74 100644
--- a/backend/src/middleware/orderByMiddleware.js
+++ b/backend/src/middleware/orderByMiddleware.js
@@ -5,7 +5,7 @@ const defaultOrderBy = (resolve, root, args, context, resolveInfo) => {
const newestFirst = {
kind: 'Argument',
name: { kind: 'Name', value: 'orderBy' },
- value: { kind: 'EnumValue', value: 'createdAt_desc' }
+ value: { kind: 'EnumValue', value: 'createdAt_desc' },
}
const [fieldNode] = copy.fieldNodes
if (fieldNode) fieldNode.arguments.push(newestFirst)
@@ -14,6 +14,6 @@ const defaultOrderBy = (resolve, root, args, context, resolveInfo) => {
export default {
Query: {
- Post: defaultOrderBy
- }
+ Post: defaultOrderBy,
+ },
}
diff --git a/backend/src/middleware/orderByMiddleware.spec.js b/backend/src/middleware/orderByMiddleware.spec.js
index 2d85452e5..658447160 100644
--- a/backend/src/middleware/orderByMiddleware.spec.js
+++ b/backend/src/middleware/orderByMiddleware.spec.js
@@ -35,7 +35,7 @@ describe('Query', () => {
{ title: 'last' },
{ title: 'third' },
{ title: 'second' },
- { title: 'first' }
+ { title: 'first' },
]
const expected = { Post: posts }
await expect(client.request(query)).resolves.toEqual(expected)
@@ -51,7 +51,7 @@ describe('Query', () => {
{ title: 'first' },
{ title: 'second' },
{ title: 'third' },
- { title: 'last' }
+ { title: 'last' },
]
const expected = { Post: posts }
await expect(client.request(query)).resolves.toEqual(expected)
diff --git a/backend/src/middleware/passwordMiddleware.js b/backend/src/middleware/passwordMiddleware.js
index 16272421a..1078e5529 100644
--- a/backend/src/middleware/passwordMiddleware.js
+++ b/backend/src/middleware/passwordMiddleware.js
@@ -8,7 +8,7 @@ export default {
const result = await resolve(root, args, context, info)
result.password = '*****'
return result
- }
+ },
},
Query: async (resolve, root, args, context, info) => {
let result = await resolve(root, args, context, info)
@@ -17,5 +17,5 @@ export default {
return '*****'
})
return result
- }
+ },
}
diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js
index 85c584407..2e7a2cd1a 100644
--- a/backend/src/middleware/permissionsMiddleware.js
+++ b/backend/src/middleware/permissionsMiddleware.js
@@ -13,7 +13,7 @@ const isModerator = rule()(async (parent, args, { user }, info) => {
})
const isAdmin = rule()(async (parent, args, { user }, info) => {
- return user && (user.role === 'admin')
+ return user && user.role === 'admin'
})
const isMyOwn = rule({ cache: 'no_cache' })(async (parent, args, context, info) => {
@@ -21,14 +21,20 @@ const isMyOwn = rule({ cache: 'no_cache' })(async (parent, args, context, info)
})
const belongsToMe = rule({ cache: 'no_cache' })(async (_, args, context) => {
- const { driver, user: { id: userId } } = context
+ const {
+ driver,
+ user: { id: userId },
+ } = context
const { id: notificationId } = args
const session = driver.session()
- const result = await session.run(`
+ const result = await session.run(
+ `
MATCH (u:User {id: $userId})<-[:NOTIFIED]-(n:Notification {id: $notificationId})
RETURN n
- `, { userId, notificationId })
- const [notification] = result.records.map((record) => {
+ `,
+ { userId, notificationId },
+ )
+ const [notification] = result.records.map(record => {
return record.get('n')
})
session.close()
@@ -44,14 +50,19 @@ const isAuthor = rule({ cache: 'no_cache' })(async (parent, args, { user, driver
if (!user) return false
const session = driver.session()
const { id: postId } = args
- const result = await session.run(`
+ const result = await session.run(
+ `
MATCH (post:Post {id: $postId})<-[:WROTE]-(author)
RETURN author
- `, { postId })
- const [author] = result.records.map((record) => {
+ `,
+ { postId },
+ )
+ const [author] = result.records.map(record => {
return record.get('author')
})
- const { properties: { id: authorId } } = author
+ const {
+ properties: { id: authorId },
+ } = author
session.close()
return authorId === user.id
})
@@ -62,7 +73,7 @@ const permissions = shield({
Notification: isAdmin,
statistics: allow,
currentUser: allow,
- Post: or(onlyEnabledContent, isModerator)
+ Post: or(onlyEnabledContent, isModerator),
},
Mutation: {
UpdateNotification: belongsToMe,
@@ -88,14 +99,14 @@ const permissions = shield({
changePassword: isAuthenticated,
enable: isModerator,
disable: isModerator,
- CreateComment: isAuthenticated
+ CreateComment: isAuthenticated,
// CreateUser: allow,
},
User: {
email: isMyOwn,
password: isMyOwn,
- privateKey: isMyOwn
- }
+ privateKey: isMyOwn,
+ },
})
export default permissions
diff --git a/backend/src/middleware/permissionsMiddleware.spec.js b/backend/src/middleware/permissionsMiddleware.spec.js
index e3c4beb00..fc1815631 100644
--- a/backend/src/middleware/permissionsMiddleware.spec.js
+++ b/backend/src/middleware/permissionsMiddleware.spec.js
@@ -10,12 +10,12 @@ describe('authorization', () => {
await factory.create('User', {
email: 'owner@example.org',
name: 'Owner',
- password: 'iamtheowner'
+ password: 'iamtheowner',
})
await factory.create('User', {
email: 'someone@example.org',
name: 'Someone else',
- password: 'else'
+ password: 'else',
})
})
@@ -39,14 +39,14 @@ describe('authorization', () => {
await expect(action()).rejects.toThrow('Not Authorised!')
})
- it('does not expose the owner\'s email address', async () => {
+ it("does not expose the owner's email address", async () => {
let response = {}
try {
await action()
} catch (error) {
response = error.response.data
} finally {
- expect(response).toEqual({ User: [ null ] })
+ expect(response).toEqual({ User: [null] })
}
})
})
@@ -55,12 +55,12 @@ describe('authorization', () => {
beforeEach(() => {
loginCredentials = {
email: 'owner@example.org',
- password: 'iamtheowner'
+ password: 'iamtheowner',
}
})
- it('exposes the owner\'s email address', async () => {
- await expect(action()).resolves.toEqual({ User: [ { email: 'owner@example.org' } ] })
+ it("exposes the owner's email address", async () => {
+ await expect(action()).resolves.toEqual({ User: [{ email: 'owner@example.org' }] })
})
})
@@ -68,7 +68,7 @@ describe('authorization', () => {
beforeEach(async () => {
loginCredentials = {
email: 'someone@example.org',
- password: 'else'
+ password: 'else',
}
})
@@ -76,14 +76,14 @@ describe('authorization', () => {
await expect(action()).rejects.toThrow('Not Authorised!')
})
- it('does not expose the owner\'s email address', async () => {
+ it("does not expose the owner's email address", async () => {
let response
try {
await action()
} catch (error) {
response = error.response.data
}
- expect(response).toEqual({ User: [ null ] })
+ expect(response).toEqual({ User: [null] })
})
})
})
diff --git a/backend/src/middleware/sluggifyMiddleware.js b/backend/src/middleware/sluggifyMiddleware.js
index c94feb55e..2b1f25d5c 100644
--- a/backend/src/middleware/sluggifyMiddleware.js
+++ b/backend/src/middleware/sluggifyMiddleware.js
@@ -3,12 +3,9 @@ import uniqueSlug from './slugify/uniqueSlug'
const isUniqueFor = (context, type) => {
return async slug => {
const session = context.driver.session()
- const response = await session.run(
- `MATCH(p:${type} {slug: $slug }) return p.slug`,
- {
- slug
- }
- )
+ const response = await session.run(`MATCH(p:${type} {slug: $slug }) return p.slug`, {
+ slug,
+ })
session.close()
return response.records.length === 0
}
@@ -17,28 +14,20 @@ const isUniqueFor = (context, type) => {
export default {
Mutation: {
CreatePost: async (resolve, root, args, context, info) => {
- args.slug =
- args.slug ||
- (await uniqueSlug(args.title, isUniqueFor(context, 'Post')))
+ args.slug = args.slug || (await uniqueSlug(args.title, isUniqueFor(context, 'Post')))
return resolve(root, args, context, info)
},
CreateUser: async (resolve, root, args, context, info) => {
- args.slug =
- args.slug ||
- (await uniqueSlug(args.name, isUniqueFor(context, 'User')))
+ args.slug = args.slug || (await uniqueSlug(args.name, isUniqueFor(context, 'User')))
return resolve(root, args, context, info)
},
CreateOrganization: async (resolve, root, args, context, info) => {
- args.slug =
- args.slug ||
- (await uniqueSlug(args.name, isUniqueFor(context, 'Organization')))
+ args.slug = args.slug || (await uniqueSlug(args.name, isUniqueFor(context, 'Organization')))
return resolve(root, args, context, info)
},
CreateCategory: async (resolve, root, args, context, info) => {
- args.slug =
- args.slug ||
- (await uniqueSlug(args.name, isUniqueFor(context, 'Category')))
+ args.slug = args.slug || (await uniqueSlug(args.name, isUniqueFor(context, 'Category')))
return resolve(root, args, context, info)
- }
- }
+ },
+ },
}
diff --git a/backend/src/middleware/slugify/uniqueSlug.js b/backend/src/middleware/slugify/uniqueSlug.js
index 64e38c8ae..69aef2d1b 100644
--- a/backend/src/middleware/slugify/uniqueSlug.js
+++ b/backend/src/middleware/slugify/uniqueSlug.js
@@ -1,7 +1,7 @@
import slugify from 'slug'
-export default async function uniqueSlug (string, isUnique) {
+export default async function uniqueSlug(string, isUnique) {
let slug = slugify(string || 'anonymous', {
- lower: true
+ lower: true,
})
if (await isUnique(slug)) return slug
@@ -10,6 +10,6 @@ export default async function uniqueSlug (string, isUnique) {
do {
count += 1
uniqueSlug = `${slug}-${count}`
- } while (!await isUnique(uniqueSlug))
+ } while (!(await isUnique(uniqueSlug)))
return uniqueSlug
}
diff --git a/backend/src/middleware/slugify/uniqueSlug.spec.js b/backend/src/middleware/slugify/uniqueSlug.spec.js
index 6772a20c2..e34af86a1 100644
--- a/backend/src/middleware/slugify/uniqueSlug.spec.js
+++ b/backend/src/middleware/slugify/uniqueSlug.spec.js
@@ -3,14 +3,14 @@ import uniqueSlug from './uniqueSlug'
describe('uniqueSlug', () => {
it('slugifies given string', () => {
const string = 'Hello World'
- const isUnique = jest.fn()
- .mockResolvedValue(true)
+ const isUnique = jest.fn().mockResolvedValue(true)
expect(uniqueSlug(string, isUnique)).resolves.toEqual('hello-world')
})
it('increments slugified string until unique', () => {
const string = 'Hello World'
- const isUnique = jest.fn()
+ const isUnique = jest
+ .fn()
.mockResolvedValueOnce(false)
.mockResolvedValueOnce(true)
expect(uniqueSlug(string, isUnique)).resolves.toEqual('hello-world-1')
@@ -18,8 +18,7 @@ describe('uniqueSlug', () => {
it('slugify null string', () => {
const string = null
- const isUnique = jest.fn()
- .mockResolvedValue(true)
+ const isUnique = jest.fn().mockResolvedValue(true)
expect(uniqueSlug(string, isUnique)).resolves.toEqual('anonymous')
})
})
diff --git a/backend/src/middleware/slugifyMiddleware.spec.js b/backend/src/middleware/slugifyMiddleware.spec.js
index 6e667056c..7ca4ec193 100644
--- a/backend/src/middleware/slugifyMiddleware.spec.js
+++ b/backend/src/middleware/slugifyMiddleware.spec.js
@@ -10,7 +10,7 @@ beforeEach(async () => {
await factory.create('User', { email: 'user@example.org', password: '1234' })
await factory.create('User', {
email: 'someone@example.org',
- password: '1234'
+ password: '1234',
})
headers = await login({ email: 'user@example.org', password: '1234' })
authenticatedClient = new GraphQLClient(host, { headers })
@@ -30,7 +30,7 @@ describe('slugify', () => {
) { slug }
}`)
expect(response).toEqual({
- CreatePost: { slug: 'i-am-a-brand-new-post' }
+ CreatePost: { slug: 'i-am-a-brand-new-post' },
})
})
@@ -38,11 +38,11 @@ describe('slugify', () => {
beforeEach(async () => {
const asSomeoneElse = await Factory().authenticateAs({
email: 'someone@example.org',
- password: '1234'
+ password: '1234',
})
await asSomeoneElse.create('Post', {
title: 'Pre-existing post',
- slug: 'pre-existing-post'
+ slug: 'pre-existing-post',
})
})
@@ -54,7 +54,7 @@ describe('slugify', () => {
) { slug }
}`)
expect(response).toEqual({
- CreatePost: { slug: 'pre-existing-post-1' }
+ CreatePost: { slug: 'pre-existing-post-1' },
})
})
@@ -67,7 +67,7 @@ describe('slugify', () => {
content: "Some content",
slug: "pre-existing-post"
) { slug }
- }`)
+ }`),
).rejects.toThrow('already exists')
})
})
@@ -81,32 +81,26 @@ describe('slugify', () => {
}`)
}
it('generates a slug based on name', async () => {
- await expect(
- action('CreateUser', 'name: "I am a user"')
- ).resolves.toEqual({ CreateUser: { slug: 'i-am-a-user' } })
+ await expect(action('CreateUser', 'name: "I am a user"')).resolves.toEqual({
+ CreateUser: { slug: 'i-am-a-user' },
+ })
})
describe('if slug exists', () => {
beforeEach(async () => {
- await action(
- 'CreateUser',
- 'name: "Pre-existing user", slug: "pre-existing-user"'
- )
+ await action('CreateUser', 'name: "Pre-existing user", slug: "pre-existing-user"')
})
it('chooses another slug', async () => {
- await expect(
- action('CreateUser', 'name: "pre-existing-user"')
- ).resolves.toEqual({ CreateUser: { slug: 'pre-existing-user-1' } })
+ await expect(action('CreateUser', 'name: "pre-existing-user"')).resolves.toEqual({
+ CreateUser: { slug: 'pre-existing-user-1' },
+ })
})
describe('but if the client specifies a slug', () => {
it('rejects CreateUser', async () => {
await expect(
- action(
- 'CreateUser',
- 'name: "Pre-existing user", slug: "pre-existing-user"'
- )
+ action('CreateUser', 'name: "Pre-existing user", slug: "pre-existing-user"'),
).rejects.toThrow('already exists')
})
})
diff --git a/backend/src/middleware/softDeleteMiddleware.js b/backend/src/middleware/softDeleteMiddleware.js
index 53beca219..cc5aa06c5 100644
--- a/backend/src/middleware/softDeleteMiddleware.js
+++ b/backend/src/middleware/softDeleteMiddleware.js
@@ -30,7 +30,7 @@ export default {
Query: {
Post: setDefaultFilters,
Comment: setDefaultFilters,
- User: setDefaultFilters
+ User: setDefaultFilters,
},
Mutation: async (resolve, root, args, context, info) => {
args.disabled = false
@@ -42,5 +42,5 @@ export default {
},
Post: obfuscateDisabled,
User: obfuscateDisabled,
- Comment: obfuscateDisabled
+ Comment: obfuscateDisabled,
}
diff --git a/backend/src/middleware/softDeleteMiddleware.spec.js b/backend/src/middleware/softDeleteMiddleware.spec.js
index f007888ed..4265599dd 100644
--- a/backend/src/middleware/softDeleteMiddleware.spec.js
+++ b/backend/src/middleware/softDeleteMiddleware.spec.js
@@ -11,32 +11,51 @@ beforeAll(async () => {
// For performance reasons we do this only once
await Promise.all([
factory.create('User', { id: 'u1', role: 'user', email: 'user@example.org', password: '1234' }),
- factory.create('User', { id: 'm1', role: 'moderator', email: 'moderator@example.org', password: '1234' }),
- factory.create('User', { id: 'u2', role: 'user', name: 'Offensive Name', avatar: '/some/offensive/avatar.jpg', about: 'This self description is very offensive', email: 'troll@example.org', password: '1234' })
+ factory.create('User', {
+ id: 'm1',
+ role: 'moderator',
+ email: 'moderator@example.org',
+ password: '1234',
+ }),
+ factory.create('User', {
+ id: 'u2',
+ role: 'user',
+ name: 'Offensive Name',
+ avatar: '/some/offensive/avatar.jpg',
+ about: 'This self description is very offensive',
+ email: 'troll@example.org',
+ password: '1234',
+ }),
])
await factory.authenticateAs({ email: 'user@example.org', password: '1234' })
await Promise.all([
factory.follow({ id: 'u2', type: 'User' }),
factory.create('Post', { id: 'p1', title: 'Deleted post', deleted: true }),
- factory.create('Post', { id: 'p3', title: 'Publicly visible post', deleted: false })
+ factory.create('Post', { id: 'p3', title: 'Publicly visible post', deleted: false }),
])
await Promise.all([
- factory.create('Comment', { id: 'c2', postId: 'p3', content: 'Enabled comment on public post' })
+ factory.create('Comment', {
+ id: 'c2',
+ postId: 'p3',
+ content: 'Enabled comment on public post',
+ }),
])
- await Promise.all([
- factory.relate('Comment', 'Author', { from: 'u1', to: 'c2' })
- ])
+ await Promise.all([factory.relate('Comment', 'Author', { from: 'u1', to: 'c2' })])
const asTroll = Factory()
await asTroll.authenticateAs({ email: 'troll@example.org', password: '1234' })
- await asTroll.create('Post', { id: 'p2', title: 'Disabled post', content: 'This is an offensive post content', image: '/some/offensive/image.jpg', deleted: false })
+ await asTroll.create('Post', {
+ id: 'p2',
+ title: 'Disabled post',
+ content: 'This is an offensive post content',
+ image: '/some/offensive/image.jpg',
+ deleted: false,
+ })
await asTroll.create('Comment', { id: 'c1', postId: 'p3', content: 'Disabled comment' })
- await Promise.all([
- asTroll.relate('Comment', 'Author', { from: 'u2', to: 'c1' })
- ])
+ await Promise.all([asTroll.relate('Comment', 'Author', { from: 'u2', to: 'c1' })])
const asModerator = Factory()
await asModerator.authenticateAs({ email: 'moderator@example.org', password: '1234' })
@@ -65,7 +84,8 @@ describe('softDeleteMiddleware', () => {
user = response.User[0].following[0]
}
const beforePost = async () => {
- query = '{ User(id: "u1") { following { contributions { title image content contentExcerpt } } } }'
+ query =
+ '{ User(id: "u1") { following { contributions { title image content contentExcerpt } } } }'
const response = await action()
post = response.User[0].following[0].contributions[0]
}
@@ -84,7 +104,8 @@ describe('softDeleteMiddleware', () => {
beforeEach(beforeUser)
it('displays name', () => expect(user.name).toEqual('Offensive Name'))
- it('displays about', () => expect(user.about).toEqual('This self description is very offensive'))
+ it('displays about', () =>
+ expect(user.about).toEqual('This self description is very offensive'))
it('displays avatar', () => expect(user.avatar).toEqual('/some/offensive/avatar.jpg'))
})
@@ -92,8 +113,10 @@ describe('softDeleteMiddleware', () => {
beforeEach(beforePost)
it('displays title', () => expect(post.title).toEqual('Disabled post'))
- it('displays content', () => expect(post.content).toEqual('This is an offensive post content'))
- it('displays contentExcerpt', () => expect(post.contentExcerpt).toEqual('This is an offensive post content'))
+ it('displays content', () =>
+ expect(post.content).toEqual('This is an offensive post content'))
+ it('displays contentExcerpt', () =>
+ expect(post.contentExcerpt).toEqual('This is an offensive post content'))
it('displays image', () => expect(post.image).toEqual('/some/offensive/image.jpg'))
})
@@ -101,7 +124,8 @@ describe('softDeleteMiddleware', () => {
beforeEach(beforeComment)
it('displays content', () => expect(comment.content).toEqual('Disabled comment'))
- it('displays contentExcerpt', () => expect(comment.contentExcerpt).toEqual('Disabled comment'))
+ it('displays contentExcerpt', () =>
+ expect(comment.contentExcerpt).toEqual('Disabled comment'))
})
})
@@ -162,10 +186,7 @@ describe('softDeleteMiddleware', () => {
})
it('shows disabled but hides deleted posts', async () => {
- const expected = [
- { title: 'Disabled post' },
- { title: 'Publicly visible post' }
- ]
+ const expected = [{ title: 'Disabled post' }, { title: 'Publicly visible post' }]
const { Post } = await action()
await expect(Post).toEqual(expect.arrayContaining(expected))
})
@@ -185,9 +206,11 @@ describe('softDeleteMiddleware', () => {
it('conceals disabled comments', async () => {
const expected = [
{ content: 'Enabled comment on public post' },
- { content: 'UNAVAILABLE' }
+ { content: 'UNAVAILABLE' },
]
- const { Post: [{ comments }] } = await action()
+ const {
+ Post: [{ comments }],
+ } = await action()
await expect(comments).toEqual(expect.arrayContaining(expected))
})
})
@@ -201,9 +224,11 @@ describe('softDeleteMiddleware', () => {
it('shows disabled comments', async () => {
const expected = [
{ content: 'Enabled comment on public post' },
- { content: 'Disabled comment' }
+ { content: 'Disabled comment' },
]
- const { Post: [{ comments }] } = await action()
+ const {
+ Post: [{ comments }],
+ } = await action()
await expect(comments).toEqual(expect.arrayContaining(expected))
})
})
diff --git a/backend/src/middleware/userMiddleware.js b/backend/src/middleware/userMiddleware.js
index b3fc1bf2c..079ba310a 100644
--- a/backend/src/middleware/userMiddleware.js
+++ b/backend/src/middleware/userMiddleware.js
@@ -15,6 +15,6 @@ export default {
const result = await resolve(root, args, context, info)
await createOrUpdateLocations(args.id, args.locationName, context.driver)
return result
- }
- }
+ },
+ },
}
diff --git a/backend/src/middleware/validation/index.js b/backend/src/middleware/validation/index.js
index de9be72e9..8e9be59ef 100644
--- a/backend/src/middleware/validation/index.js
+++ b/backend/src/middleware/validation/index.js
@@ -26,6 +26,6 @@ export default {
Mutation: {
CreateUser: validateUsername,
UpdateUser: validateUsername,
- CreateSocialMedia: validateUrl
- }
+ CreateSocialMedia: validateUrl,
+ },
}
diff --git a/backend/src/middleware/xssMiddleware.js b/backend/src/middleware/xssMiddleware.js
index 2607f4210..06aa5b306 100644
--- a/backend/src/middleware/xssMiddleware.js
+++ b/backend/src/middleware/xssMiddleware.js
@@ -5,7 +5,7 @@ import sanitizeHtml from 'sanitize-html'
import cheerio from 'cheerio'
import linkifyHtml from 'linkifyjs/html'
-const embedToAnchor = (content) => {
+const embedToAnchor = content => {
const $ = cheerio.load(content)
$('div[data-url-embed]').each((i, el) => {
let url = el.attribs['data-url-embed']
@@ -15,7 +15,7 @@ const embedToAnchor = (content) => {
return $('body').html()
}
-function clean (dirty) {
+function clean(dirty) {
if (!dirty) {
return dirty
}
@@ -24,27 +24,48 @@ function clean (dirty) {
dirty = embedToAnchor(dirty)
dirty = linkifyHtml(dirty)
dirty = sanitizeHtml(dirty, {
- allowedTags: ['iframe', 'img', 'p', 'h3', 'h4', 'br', 'hr', 'b', 'i', 'em', 'strong', 'a', 'pre', 'ul', 'li', 'ol', 's', 'strike', 'span', 'blockquote'],
+ allowedTags: [
+ 'iframe',
+ 'img',
+ 'p',
+ 'h3',
+ 'h4',
+ 'br',
+ 'hr',
+ 'b',
+ 'i',
+ 'em',
+ 'strong',
+ 'a',
+ 'pre',
+ 'ul',
+ 'li',
+ 'ol',
+ 's',
+ 'strike',
+ 'span',
+ 'blockquote',
+ ],
allowedAttributes: {
a: ['href', 'class', 'target', 'data-*', 'contenteditable'],
span: ['contenteditable', 'class', 'data-*'],
img: ['src'],
- iframe: ['src', 'class', 'frameborder', 'allowfullscreen']
+ iframe: ['src', 'class', 'frameborder', 'allowfullscreen'],
},
allowedIframeHostnames: ['www.youtube.com', 'player.vimeo.com'],
parser: {
- lowerCaseTags: true
+ lowerCaseTags: true,
},
transformTags: {
- iframe: function (tagName, attribs) {
+ iframe: function(tagName, attribs) {
return {
tagName: 'a',
text: attribs.src,
attribs: {
href: attribs.src,
target: '_blank',
- 'data-url-embed': ''
- }
+ 'data-url-embed': '',
+ },
}
},
h1: 'h3',
@@ -53,19 +74,19 @@ function clean (dirty) {
h4: 'h4',
h5: 'strong',
i: 'em',
- a: function (tagName, attribs) {
+ a: function(tagName, attribs) {
return {
tagName: 'a',
attribs: {
href: attribs.href,
target: '_blank',
- rel: 'noopener noreferrer nofollow'
- }
+ rel: 'noopener noreferrer nofollow',
+ },
}
},
b: 'strong',
s: 'strike',
- img: function (tagName, attribs) {
+ img: function(tagName, attribs) {
let src = attribs.src
if (!src) {
@@ -88,11 +109,11 @@ function clean (dirty) {
tagName: 'img',
attribs: {
// TODO: use environment variables
- src: `http://localhost:3050/images?url=${src}`
- }
+ src: `http://localhost:3050/images?url=${src}`,
+ },
}
- }
- }
+ },
+ },
})
// remove empty html tags and duplicated linebreaks and returns
@@ -100,10 +121,7 @@ function clean (dirty) {
// remove all tags with "space only"
.replace(/<[a-z-]+>[\s]+<\/[a-z-]+>/gim, '')
// remove all iframes
- .replace(
- /(
'
- )
+ .replace(/<\/(p|div|th|tr)>\s*( \s*)+\s*<(p|div|th|tr)>/gim, '
')
// remove additional linebreaks inside p tags
- .replace(
- /<[a-z-]+>(<[a-z-]+>)*\s*( \s*)+\s*(<\/[a-z-]+>)*<\/[a-z-]+>/gim,
- ''
- )
+ .replace(/<[a-z-]+>(<[a-z-]+>)*\s*( \s*)+\s*(<\/[a-z-]+>)*<\/[a-z-]+>/gim, '')
// remove additional linebreaks when first child inside p tags
.replace(/
(\s* \s*)+/gim, '
')
// remove additional linebreaks when last child inside p tags
@@ -138,5 +150,5 @@ export default {
Query: async (resolve, root, args, context, info) => {
const result = await resolve(root, args, context, info)
return walkRecursive(result, fields, clean)
- }
+ },
}
diff --git a/backend/src/mocks/index.js b/backend/src/mocks/index.js
index a87ccfbbc..7b453c8c6 100644
--- a/backend/src/mocks/index.js
+++ b/backend/src/mocks/index.js
@@ -1,15 +1,14 @@
-
import faker from 'faker'
export default {
User: () => ({
name: () => `${faker.name.firstName()} ${faker.name.lastName()}`,
- email: () => `${faker.internet.email()}`
+ email: () => `${faker.internet.email()}`,
}),
Post: () => ({
title: () => faker.lorem.lines(1),
slug: () => faker.lorem.slug(3),
content: () => faker.lorem.paragraphs(5),
- contentExcerpt: () => faker.lorem.paragraphs(1)
- })
+ contentExcerpt: () => faker.lorem.paragraphs(1),
+ }),
}
diff --git a/backend/src/resolvers/badges.spec.js b/backend/src/resolvers/badges.spec.js
index 1966ce241..f5e15f4a2 100644
--- a/backend/src/resolvers/badges.spec.js
+++ b/backend/src/resolvers/badges.spec.js
@@ -10,17 +10,17 @@ describe('badges', () => {
await factory.create('User', {
email: 'user@example.org',
role: 'user',
- password: '1234'
+ password: '1234',
})
await factory.create('User', {
id: 'u2',
role: 'moderator',
- email: 'moderator@example.org'
+ email: 'moderator@example.org',
})
await factory.create('User', {
id: 'u3',
role: 'admin',
- email: 'admin@example.org'
+ email: 'admin@example.org',
})
})
@@ -34,7 +34,7 @@ describe('badges', () => {
key: 'indiegogo_en_racoon',
type: 'crowdfunding',
status: 'permanent',
- icon: '/img/badges/indiegogo_en_racoon.svg'
+ icon: '/img/badges/indiegogo_en_racoon.svg',
}
const mutation = `
@@ -58,9 +58,7 @@ describe('badges', () => {
describe('unauthenticated', () => {
it('throws authorization error', async () => {
client = new GraphQLClient(host)
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -76,8 +74,8 @@ describe('badges', () => {
id: 'b1',
key: 'indiegogo_en_racoon',
status: 'permanent',
- type: 'crowdfunding'
- }
+ type: 'crowdfunding',
+ },
}
await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
@@ -90,9 +88,7 @@ describe('badges', () => {
})
it('throws authorization error', async () => {
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
})
@@ -104,7 +100,7 @@ describe('badges', () => {
})
const variables = {
id: 'b1',
- key: 'whatever'
+ key: 'whatever',
}
const mutation = `
@@ -119,9 +115,7 @@ describe('badges', () => {
describe('unauthenticated', () => {
it('throws authorization error', async () => {
client = new GraphQLClient(host)
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -132,9 +126,7 @@ describe('badges', () => {
})
it('throws authorization error', async () => {
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -147,8 +139,8 @@ describe('badges', () => {
const expected = {
UpdateBadge: {
id: 'b1',
- key: 'whatever'
- }
+ key: 'whatever',
+ },
}
await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
@@ -161,7 +153,7 @@ describe('badges', () => {
await factory.create('Badge', { id: 'b1' })
})
const variables = {
- id: 'b1'
+ id: 'b1',
}
const mutation = `
@@ -175,9 +167,7 @@ describe('badges', () => {
describe('unauthenticated', () => {
it('throws authorization error', async () => {
client = new GraphQLClient(host)
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -188,9 +178,7 @@ describe('badges', () => {
})
it('throws authorization error', async () => {
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -202,8 +190,8 @@ describe('badges', () => {
it('deletes a badge', async () => {
const expected = {
DeleteBadge: {
- id: 'b1'
- }
+ id: 'b1',
+ },
}
await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
diff --git a/backend/src/resolvers/comments.js b/backend/src/resolvers/comments.js
index d4775b235..949b77041 100644
--- a/backend/src/resolvers/comments.js
+++ b/backend/src/resolvers/comments.js
@@ -23,11 +23,13 @@ export default {
}
const session = context.driver.session()
- const postQueryRes = await session.run(`
+ const postQueryRes = await session.run(
+ `
MATCH (post:Post {id: $postId})
- RETURN post`, {
- postId
- }
+ RETURN post`,
+ {
+ postId,
+ },
)
const [post] = postQueryRes.records.map(record => {
return record.get('post')
@@ -38,18 +40,20 @@ export default {
}
const comment = await neo4jgraphql(object, params, context, resolveInfo, false)
- await session.run(`
+ await session.run(
+ `
MATCH (post:Post {id: $postId}), (comment:Comment {id: $commentId}), (author:User {id: $userId})
MERGE (post)<-[:COMMENTS]-(comment)<-[:WROTE]-(author)
- RETURN post`, {
- userId: context.user.id,
- postId,
- commentId: comment.id
- }
+ RETURN post`,
+ {
+ userId: context.user.id,
+ postId,
+ commentId: comment.id,
+ },
)
session.close()
return comment
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/comments.spec.js b/backend/src/resolvers/comments.spec.js
index 87a0df270..451c559f1 100644
--- a/backend/src/resolvers/comments.spec.js
+++ b/backend/src/resolvers/comments.spec.js
@@ -12,7 +12,7 @@ let createCommentVariablesWithNonExistentPost
beforeEach(async () => {
await factory.create('User', {
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -47,10 +47,12 @@ describe('CreateComment', () => {
it('throws authorization error', async () => {
createCommentVariables = {
postId: 'p1',
- content: 'I\'m not authorised to comment'
+ content: "I'm not authorised to comment",
}
client = new GraphQLClient(host)
- await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow('Not Authorised')
+ await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow(
+ 'Not Authorised',
+ )
})
})
@@ -61,12 +63,12 @@ describe('CreateComment', () => {
client = new GraphQLClient(host, { headers })
createCommentVariables = {
postId: 'p1',
- content: 'I\'m authorised to comment'
+ content: "I'm authorised to comment",
}
createPostVariables = {
id: 'p1',
title: 'post to comment on',
- content: 'please comment on me'
+ content: 'please comment on me',
}
await client.request(createPostMutation, createPostVariables)
})
@@ -74,11 +76,13 @@ describe('CreateComment', () => {
it('creates a comment', async () => {
const expected = {
CreateComment: {
- content: 'I\'m authorised to comment'
- }
+ content: "I'm authorised to comment",
+ },
}
- await expect(client.request(createCommentMutation, createCommentVariables)).resolves.toMatchObject(expected)
+ await expect(
+ client.request(createCommentMutation, createCommentVariables),
+ ).resolves.toMatchObject(expected)
})
it('assigns the authenticated user as author', async () => {
@@ -92,86 +96,96 @@ describe('CreateComment', () => {
}
}`)
- expect(User).toEqual([ { comments: [ { content: 'I\'m authorised to comment' } ] } ])
+ expect(User).toEqual([{ comments: [{ content: "I'm authorised to comment" }] }])
})
it('throw an error if an empty string is sent from the editor as content', async () => {
createCommentVariables = {
postId: 'p1',
- content: '
'
+ content: '
',
}
- await expect(client.request(createCommentMutation, createCommentVariables))
- .rejects.toThrow('Comment must be at least 1 character long!')
+ await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow(
+ 'Comment must be at least 1 character long!',
+ )
})
it('throws an error if a comment sent from the editor does not contain a single character', async () => {
createCommentVariables = {
postId: 'p1',
- content: '
'
+ content: '
',
}
- await expect(client.request(createCommentMutation, createCommentVariables))
- .rejects.toThrow('Comment must be at least 1 character long!')
+ await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow(
+ 'Comment must be at least 1 character long!',
+ )
})
it('throws an error if postId is sent as an empty string', async () => {
createCommentVariables = {
postId: 'p1',
- content: ''
+ content: '',
}
- await expect(client.request(createCommentMutation, createCommentVariables))
- .rejects.toThrow('Comment must be at least 1 character long!')
+ await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow(
+ 'Comment must be at least 1 character long!',
+ )
})
it('throws an error if content is sent as an string of empty characters', async () => {
createCommentVariables = {
postId: 'p1',
- content: ' '
+ content: ' ',
}
- await expect(client.request(createCommentMutation, createCommentVariables))
- .rejects.toThrow('Comment must be at least 1 character long!')
+ await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow(
+ 'Comment must be at least 1 character long!',
+ )
})
it('throws an error if postId is sent as an empty string', async () => {
createCommentVariablesSansPostId = {
postId: '',
- content: 'this comment should not be created'
+ content: 'this comment should not be created',
}
- await expect(client.request(createCommentMutation, createCommentVariablesSansPostId))
- .rejects.toThrow('Comment cannot be created without a post!')
+ await expect(
+ client.request(createCommentMutation, createCommentVariablesSansPostId),
+ ).rejects.toThrow('Comment cannot be created without a post!')
})
it('throws an error if postId is sent as an string of empty characters', async () => {
createCommentVariablesSansPostId = {
postId: ' ',
- content: 'this comment should not be created'
+ content: 'this comment should not be created',
}
- await expect(client.request(createCommentMutation, createCommentVariablesSansPostId))
- .rejects.toThrow('Comment cannot be created without a post!')
+ await expect(
+ client.request(createCommentMutation, createCommentVariablesSansPostId),
+ ).rejects.toThrow('Comment cannot be created without a post!')
})
it('throws an error if the post does not exist in the database', async () => {
createCommentVariablesWithNonExistentPost = {
postId: 'p2',
- content: 'comment should not be created cause the post doesn\'t exist'
+ content: "comment should not be created cause the post doesn't exist",
}
- await expect(client.request(createCommentMutation, createCommentVariablesWithNonExistentPost))
- .rejects.toThrow('Comment cannot be created without a post!')
+ await expect(
+ client.request(createCommentMutation, createCommentVariablesWithNonExistentPost),
+ ).rejects.toThrow('Comment cannot be created without a post!')
})
it('does not create the comment with the postId as an attribute', async () => {
const commentQueryVariablesByContent = {
- content: 'I\'m authorised to comment'
+ content: "I'm authorised to comment",
}
await client.request(createCommentMutation, createCommentVariables)
- const { Comment } = await client.request(commentQueryForPostId, commentQueryVariablesByContent)
+ const { Comment } = await client.request(
+ commentQueryForPostId,
+ commentQueryVariablesByContent,
+ )
expect(Comment).toEqual([{ postId: null }])
})
})
diff --git a/backend/src/resolvers/follow.js b/backend/src/resolvers/follow.js
index df7b58891..4e9a3b27d 100644
--- a/backend/src/resolvers/follow.js
+++ b/backend/src/resolvers/follow.js
@@ -12,8 +12,8 @@ export default {
{
id,
type,
- userId: context.user.id
- }
+ userId: context.user.id,
+ },
)
const [isFollowed] = transactionRes.records.map(record => {
@@ -37,8 +37,8 @@ export default {
{
id,
type,
- userId: context.user.id
- }
+ userId: context.user.id,
+ },
)
const [isFollowed] = transactionRes.records.map(record => {
return record.get('isFollowed')
@@ -46,6 +46,6 @@ export default {
session.close()
return isFollowed
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/follow.spec.js b/backend/src/resolvers/follow.spec.js
index 081e49081..4a361b03d 100644
--- a/backend/src/resolvers/follow.spec.js
+++ b/backend/src/resolvers/follow.spec.js
@@ -6,12 +6,12 @@ const factory = Factory()
let clientUser1
let headersUser1
-const mutationFollowUser = (id) => `
+const mutationFollowUser = id => `
mutation {
follow(id: "${id}", type: User)
}
`
-const mutationUnfollowUser = (id) => `
+const mutationUnfollowUser = id => `
mutation {
unfollow(id: "${id}", type: User)
}
@@ -21,12 +21,12 @@ beforeEach(async () => {
await factory.create('User', {
id: 'u1',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
await factory.create('User', {
id: 'u2',
email: 'test2@example.org',
- password: '1234'
+ password: '1234',
})
headersUser1 = await login({ email: 'test@example.org', password: '1234' })
@@ -43,18 +43,14 @@ describe('follow', () => {
it('throws authorization error', async () => {
let client
client = new GraphQLClient(host)
- await expect(
- client.request(mutationFollowUser('u2'))
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutationFollowUser('u2'))).rejects.toThrow('Not Authorised')
})
})
it('I can follow another user', async () => {
- const res = await clientUser1.request(
- mutationFollowUser('u2')
- )
+ const res = await clientUser1.request(mutationFollowUser('u2'))
const expected = {
- follow: true
+ follow: true,
}
expect(res).toMatchObject(expected)
@@ -65,20 +61,16 @@ describe('follow', () => {
}
}`)
const expected2 = {
- followedBy: [
- { id: 'u1' }
- ],
- followedByCurrentUser: true
+ followedBy: [{ id: 'u1' }],
+ followedByCurrentUser: true,
}
expect(User[0]).toMatchObject(expected2)
})
it('I can`t follow myself', async () => {
- const res = await clientUser1.request(
- mutationFollowUser('u1')
- )
+ const res = await clientUser1.request(mutationFollowUser('u1'))
const expected = {
- follow: false
+ follow: false,
}
expect(res).toMatchObject(expected)
@@ -90,7 +82,7 @@ describe('follow', () => {
}`)
const expected2 = {
followedBy: [],
- followedByCurrentUser: false
+ followedByCurrentUser: false,
}
expect(User[0]).toMatchObject(expected2)
})
@@ -99,26 +91,20 @@ describe('follow', () => {
describe('unauthenticated follow', () => {
it('throws authorization error', async () => {
// follow
- await clientUser1.request(
- mutationFollowUser('u2')
- )
+ await clientUser1.request(mutationFollowUser('u2'))
// unfollow
let client
client = new GraphQLClient(host)
- await expect(
- client.request(mutationUnfollowUser('u2'))
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutationUnfollowUser('u2'))).rejects.toThrow('Not Authorised')
})
})
it('I can unfollow a user', async () => {
// follow
- await clientUser1.request(
- mutationFollowUser('u2')
- )
+ await clientUser1.request(mutationFollowUser('u2'))
// unfollow
const expected = {
- unfollow: true
+ unfollow: true,
}
const res = await clientUser1.request(mutationUnfollowUser('u2'))
expect(res).toMatchObject(expected)
@@ -131,7 +117,7 @@ describe('follow', () => {
}`)
const expected2 = {
followedBy: [],
- followedByCurrentUser: false
+ followedByCurrentUser: false,
}
expect(User[0]).toMatchObject(expected2)
})
diff --git a/backend/src/resolvers/moderation.js b/backend/src/resolvers/moderation.js
index 7bc1227ff..d61df7545 100644
--- a/backend/src/resolvers/moderation.js
+++ b/backend/src/resolvers/moderation.js
@@ -14,7 +14,7 @@ export default {
const session = driver.session()
const res = await session.run(cypher, { id, userId })
session.close()
- const [resource] = res.records.map((record) => {
+ const [resource] = res.records.map(record => {
return record.get('resource')
})
if (!resource) return null
@@ -31,11 +31,11 @@ export default {
const session = driver.session()
const res = await session.run(cypher, { id })
session.close()
- const [resource] = res.records.map((record) => {
+ const [resource] = res.records.map(record => {
return record.get('resource')
})
if (!resource) return null
return resource.id
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/moderation.spec.js b/backend/src/resolvers/moderation.spec.js
index 28f4dc322..835e9e535 100644
--- a/backend/src/resolvers/moderation.spec.js
+++ b/backend/src/resolvers/moderation.spec.js
@@ -5,7 +5,7 @@ import { host, login } from '../jest/helpers'
const factory = Factory()
let client
-const setupAuthenticateClient = (params) => {
+const setupAuthenticateClient = params => {
const authenticateClient = async () => {
await factory.create('User', params)
const headers = await login(params)
@@ -46,7 +46,7 @@ describe('disable', () => {
beforeEach(() => {
// our defaul set of variables
variables = {
- id: 'blabla'
+ id: 'blabla',
}
})
@@ -63,7 +63,7 @@ describe('disable', () => {
beforeEach(() => {
authenticateClient = setupAuthenticateClient({
email: 'user@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -78,19 +78,17 @@ describe('disable', () => {
id: 'u7',
email: 'moderator@example.org',
password: '1234',
- role: 'moderator'
+ role: 'moderator',
})
})
describe('on something that is not a (Comment|Post|User) ', () => {
beforeEach(async () => {
variables = {
- id: 't23'
+ id: 't23',
}
createResource = () => {
- return Promise.all([
- factory.create('Tag', { id: 't23' })
- ])
+ return Promise.all([factory.create('Tag', { id: 't23' })])
}
})
@@ -104,21 +102,28 @@ describe('disable', () => {
describe('on a comment', () => {
beforeEach(async () => {
variables = {
- id: 'c47'
+ id: 'c47',
}
createPostVariables = {
id: 'p3',
title: 'post to comment on',
- content: 'please comment on me'
+ content: 'please comment on me',
}
createCommentVariables = {
id: 'c47',
postId: 'p3',
- content: 'this comment was created for this post'
+ content: 'this comment was created for this post',
}
createResource = async () => {
- await factory.create('User', { id: 'u45', email: 'commenter@example.org', password: '1234' })
- const asAuthenticatedUser = await factory.authenticateAs({ email: 'commenter@example.org', password: '1234' })
+ await factory.create('User', {
+ id: 'u45',
+ email: 'commenter@example.org',
+ password: '1234',
+ })
+ const asAuthenticatedUser = await factory.authenticateAs({
+ email: 'commenter@example.org',
+ password: '1234',
+ })
await asAuthenticatedUser.create('Post', createPostVariables)
await asAuthenticatedUser.create('Comment', createCommentVariables)
}
@@ -135,41 +140,39 @@ describe('disable', () => {
const expected = { Comment: [{ id: 'c47', disabledBy: { id: 'u7' } }] }
await setup()
- await expect(client.request(
- '{ Comment { id, disabledBy { id } } }'
- )).resolves.toEqual(before)
+ await expect(client.request('{ Comment { id, disabledBy { id } } }')).resolves.toEqual(
+ before,
+ )
await action()
- await expect(client.request(
- '{ Comment(disabled: true) { id, disabledBy { id } } }'
- )).resolves.toEqual(expected)
+ await expect(
+ client.request('{ Comment(disabled: true) { id, disabledBy { id } } }'),
+ ).resolves.toEqual(expected)
})
it('updates .disabled on comment', async () => {
- const before = { Comment: [ { id: 'c47', disabled: false } ] }
- const expected = { Comment: [ { id: 'c47', disabled: true } ] }
+ const before = { Comment: [{ id: 'c47', disabled: false }] }
+ const expected = { Comment: [{ id: 'c47', disabled: true }] }
await setup()
- await expect(client.request(
- '{ Comment { id disabled } }'
- )).resolves.toEqual(before)
+ await expect(client.request('{ Comment { id disabled } }')).resolves.toEqual(before)
await action()
- await expect(client.request(
- '{ Comment(disabled: true) { id disabled } }'
- )).resolves.toEqual(expected)
+ await expect(
+ client.request('{ Comment(disabled: true) { id disabled } }'),
+ ).resolves.toEqual(expected)
})
})
describe('on a post', () => {
beforeEach(async () => {
variables = {
- id: 'p9'
+ id: 'p9',
}
createResource = async () => {
await factory.create('User', { email: 'author@example.org', password: '1234' })
await factory.authenticateAs({ email: 'author@example.org', password: '1234' })
await factory.create('Post', {
- id: 'p9' // that's the ID we will look for
+ id: 'p9', // that's the ID we will look for
})
}
})
@@ -185,27 +188,25 @@ describe('disable', () => {
const expected = { Post: [{ id: 'p9', disabledBy: { id: 'u7' } }] }
await setup()
- await expect(client.request(
- '{ Post { id, disabledBy { id } } }'
- )).resolves.toEqual(before)
+ await expect(client.request('{ Post { id, disabledBy { id } } }')).resolves.toEqual(
+ before,
+ )
await action()
- await expect(client.request(
- '{ Post(disabled: true) { id, disabledBy { id } } }'
- )).resolves.toEqual(expected)
+ await expect(
+ client.request('{ Post(disabled: true) { id, disabledBy { id } } }'),
+ ).resolves.toEqual(expected)
})
it('updates .disabled on post', async () => {
- const before = { Post: [ { id: 'p9', disabled: false } ] }
- const expected = { Post: [ { id: 'p9', disabled: true } ] }
+ const before = { Post: [{ id: 'p9', disabled: false }] }
+ const expected = { Post: [{ id: 'p9', disabled: true }] }
await setup()
- await expect(client.request(
- '{ Post { id disabled } }'
- )).resolves.toEqual(before)
+ await expect(client.request('{ Post { id disabled } }')).resolves.toEqual(before)
await action()
- await expect(client.request(
- '{ Post(disabled: true) { id disabled } }'
- )).resolves.toEqual(expected)
+ await expect(client.request('{ Post(disabled: true) { id disabled } }')).resolves.toEqual(
+ expected,
+ )
})
})
})
@@ -227,7 +228,7 @@ describe('enable', () => {
beforeEach(() => {
// our defaul set of variables
variables = {
- id: 'blabla'
+ id: 'blabla',
}
})
@@ -240,7 +241,7 @@ describe('enable', () => {
beforeEach(() => {
authenticateClient = setupAuthenticateClient({
email: 'user@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -254,20 +255,18 @@ describe('enable', () => {
authenticateClient = setupAuthenticateClient({
role: 'moderator',
email: 'someUser@example.org',
- password: '1234'
+ password: '1234',
})
})
describe('on something that is not a (Comment|Post|User) ', () => {
beforeEach(async () => {
variables = {
- id: 't23'
+ id: 't23',
}
createResource = () => {
// we cannot create a :DISABLED relationship here
- return Promise.all([
- factory.create('Tag', { id: 't23' })
- ])
+ return Promise.all([factory.create('Tag', { id: 't23' })])
}
})
@@ -281,21 +280,28 @@ describe('enable', () => {
describe('on a comment', () => {
beforeEach(async () => {
variables = {
- id: 'c456'
+ id: 'c456',
}
createPostVariables = {
id: 'p9',
title: 'post to comment on',
- content: 'please comment on me'
+ content: 'please comment on me',
}
createCommentVariables = {
id: 'c456',
postId: 'p9',
- content: 'this comment was created for this post'
+ content: 'this comment was created for this post',
}
createResource = async () => {
- await factory.create('User', { id: 'u123', email: 'author@example.org', password: '1234' })
- const asAuthenticatedUser = await factory.authenticateAs({ email: 'author@example.org', password: '1234' })
+ await factory.create('User', {
+ id: 'u123',
+ email: 'author@example.org',
+ password: '1234',
+ })
+ const asAuthenticatedUser = await factory.authenticateAs({
+ email: 'author@example.org',
+ password: '1234',
+ })
await asAuthenticatedUser.create('Post', createPostVariables)
await asAuthenticatedUser.create('Comment', createCommentVariables)
@@ -319,41 +325,43 @@ describe('enable', () => {
const expected = { Comment: [{ id: 'c456', disabledBy: null }] }
await setup()
- await expect(client.request(
- '{ Comment(disabled: true) { id, disabledBy { id } } }'
- )).resolves.toEqual(before)
+ await expect(
+ client.request('{ Comment(disabled: true) { id, disabledBy { id } } }'),
+ ).resolves.toEqual(before)
await action()
- await expect(client.request(
- '{ Comment { id, disabledBy { id } } }'
- )).resolves.toEqual(expected)
+ await expect(client.request('{ Comment { id, disabledBy { id } } }')).resolves.toEqual(
+ expected,
+ )
})
it('updates .disabled on post', async () => {
- const before = { Comment: [ { id: 'c456', disabled: true } ] }
- const expected = { Comment: [ { id: 'c456', disabled: false } ] }
+ const before = { Comment: [{ id: 'c456', disabled: true }] }
+ const expected = { Comment: [{ id: 'c456', disabled: false }] }
await setup()
- await expect(client.request(
- '{ Comment(disabled: true) { id disabled } }'
- )).resolves.toEqual(before)
+ await expect(
+ client.request('{ Comment(disabled: true) { id disabled } }'),
+ ).resolves.toEqual(before)
await action() // this updates .disabled
- await expect(client.request(
- '{ Comment { id disabled } }'
- )).resolves.toEqual(expected)
+ await expect(client.request('{ Comment { id disabled } }')).resolves.toEqual(expected)
})
})
describe('on a post', () => {
beforeEach(async () => {
variables = {
- id: 'p9'
+ id: 'p9',
}
createResource = async () => {
- await factory.create('User', { id: 'u123', email: 'author@example.org', password: '1234' })
+ await factory.create('User', {
+ id: 'u123',
+ email: 'author@example.org',
+ password: '1234',
+ })
await factory.authenticateAs({ email: 'author@example.org', password: '1234' })
await factory.create('Post', {
- id: 'p9' // that's the ID we will look for
+ id: 'p9', // that's the ID we will look for
})
const disableMutation = `
@@ -376,27 +384,25 @@ describe('enable', () => {
const expected = { Post: [{ id: 'p9', disabledBy: null }] }
await setup()
- await expect(client.request(
- '{ Post(disabled: true) { id, disabledBy { id } } }'
- )).resolves.toEqual(before)
+ await expect(
+ client.request('{ Post(disabled: true) { id, disabledBy { id } } }'),
+ ).resolves.toEqual(before)
await action()
- await expect(client.request(
- '{ Post { id, disabledBy { id } } }'
- )).resolves.toEqual(expected)
+ await expect(client.request('{ Post { id, disabledBy { id } } }')).resolves.toEqual(
+ expected,
+ )
})
it('updates .disabled on post', async () => {
- const before = { Post: [ { id: 'p9', disabled: true } ] }
- const expected = { Post: [ { id: 'p9', disabled: false } ] }
+ const before = { Post: [{ id: 'p9', disabled: true }] }
+ const expected = { Post: [{ id: 'p9', disabled: false }] }
await setup()
- await expect(client.request(
- '{ Post(disabled: true) { id disabled } }'
- )).resolves.toEqual(before)
+ await expect(client.request('{ Post(disabled: true) { id disabled } }')).resolves.toEqual(
+ before,
+ )
await action() // this updates .disabled
- await expect(client.request(
- '{ Post { id disabled } }'
- )).resolves.toEqual(expected)
+ await expect(client.request('{ Post { id disabled } }')).resolves.toEqual(expected)
})
})
})
diff --git a/backend/src/resolvers/notifications.js b/backend/src/resolvers/notifications.js
index bc3da0acf..ddc1985cf 100644
--- a/backend/src/resolvers/notifications.js
+++ b/backend/src/resolvers/notifications.js
@@ -4,11 +4,11 @@ export default {
Query: {
Notification: (object, params, context, resolveInfo) => {
return neo4jgraphql(object, params, context, resolveInfo, false)
- }
+ },
},
Mutation: {
UpdateNotification: (object, params, context, resolveInfo) => {
return neo4jgraphql(object, params, context, resolveInfo, false)
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/notifications.spec.js b/backend/src/resolvers/notifications.spec.js
index 799bc1594..37d8c83ff 100644
--- a/backend/src/resolvers/notifications.spec.js
+++ b/backend/src/resolvers/notifications.spec.js
@@ -1,4 +1,3 @@
-
import Factory from '../seed/factories'
import { GraphQLClient } from 'graphql-request'
import { host, login } from '../jest/helpers'
@@ -8,7 +7,7 @@ let client
let userParams = {
id: 'you',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
}
beforeEach(async () => {
@@ -49,12 +48,12 @@ describe('currentUser { notifications }', () => {
const neighborParams = {
email: 'neighbor@example.org',
password: '1234',
- id: 'neighbor'
+ id: 'neighbor',
}
await Promise.all([
factory.create('User', neighborParams),
factory.create('Notification', { id: 'not-for-you' }),
- factory.create('Notification', { id: 'already-seen', read: true })
+ factory.create('Notification', { id: 'already-seen', read: true }),
])
await factory.create('Notification', { id: 'unseen' })
await factory.authenticateAs(neighborParams)
@@ -65,7 +64,7 @@ describe('currentUser { notifications }', () => {
factory.relate('Notification', 'User', { from: 'unseen', to: 'you' }),
factory.relate('Notification', 'Post', { from: 'p1', to: 'unseen' }),
factory.relate('Notification', 'User', { from: 'already-seen', to: 'you' }),
- factory.relate('Notification', 'Post', { from: 'p1', to: 'already-seen' })
+ factory.relate('Notification', 'Post', { from: 'p1', to: 'already-seen' }),
])
})
@@ -84,10 +83,8 @@ describe('currentUser { notifications }', () => {
it('returns only unread notifications of current user', async () => {
const expected = {
currentUser: {
- notifications: [
- { id: 'unseen', post: { id: 'p1' } }
- ]
- }
+ notifications: [{ id: 'unseen', post: { id: 'p1' } }],
+ },
}
await expect(client.request(query, variables)).resolves.toEqual(expected)
})
@@ -109,9 +106,9 @@ describe('currentUser { notifications }', () => {
currentUser: {
notifications: [
{ id: 'unseen', post: { id: 'p1' } },
- { id: 'already-seen', post: { id: 'p1' } }
- ]
- }
+ { id: 'already-seen', post: { id: 'p1' } },
+ ],
+ },
}
await expect(client.request(query, variables)).resolves.toEqual(expected)
})
@@ -136,7 +133,7 @@ describe('UpdateNotification', () => {
id: 'mentioned-1',
email: 'mentioned@example.org',
password: '1234',
- slug: 'mentioned'
+ slug: 'mentioned',
}
await factory.create('User', mentionedParams)
await factory.create('Notification', { id: 'to-be-updated' })
@@ -144,7 +141,7 @@ describe('UpdateNotification', () => {
await factory.create('Post', { id: 'p1' })
await Promise.all([
factory.relate('Notification', 'User', { from: 'to-be-updated', to: 'mentioned-1' }),
- factory.relate('Notification', 'Post', { from: 'p1', to: 'to-be-updated' })
+ factory.relate('Notification', 'Post', { from: 'p1', to: 'to-be-updated' }),
])
})
diff --git a/backend/src/resolvers/posts.js b/backend/src/resolvers/posts.js
index 5b06c38fa..e4d0d6876 100644
--- a/backend/src/resolvers/posts.js
+++ b/backend/src/resolvers/posts.js
@@ -8,15 +8,16 @@ export default {
const session = context.driver.session()
await session.run(
'MATCH (author:User {id: $userId}), (post:Post {id: $postId}) ' +
- 'MERGE (post)<-[:WROTE]-(author) ' +
- 'RETURN author', {
+ 'MERGE (post)<-[:WROTE]-(author) ' +
+ 'RETURN author',
+ {
userId: context.user.id,
- postId: result.id
- }
+ postId: result.id,
+ },
)
session.close()
return result
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/posts.spec.js b/backend/src/resolvers/posts.spec.js
index 5603683eb..e4175ff09 100644
--- a/backend/src/resolvers/posts.spec.js
+++ b/backend/src/resolvers/posts.spec.js
@@ -8,7 +8,7 @@ let client
beforeEach(async () => {
await factory.create('User', {
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -47,22 +47,25 @@ describe('CreatePost', () => {
const expected = {
CreatePost: {
title: 'I am a title',
- content: 'Some content'
- }
+ content: 'Some content',
+ },
}
await expect(client.request(mutation)).resolves.toMatchObject(expected)
})
it('assigns the authenticated user as author', async () => {
await client.request(mutation)
- const { User } = await client.request(`{
+ const { User } = await client.request(
+ `{
User(email:"test@example.org") {
contributions {
title
}
}
- }`, { headers })
- expect(User).toEqual([ { contributions: [ { title: 'I am a title' } ] } ])
+ }`,
+ { headers },
+ )
+ expect(User).toEqual([{ contributions: [{ title: 'I am a title' }] }])
})
describe('disabled and deleted', () => {
@@ -86,22 +89,22 @@ describe('UpdatePost', () => {
let variables = {
id: 'p1',
- content: 'New content'
+ content: 'New content',
}
beforeEach(async () => {
const asAuthor = Factory()
await asAuthor.create('User', {
email: 'author@example.org',
- password: '1234'
+ password: '1234',
})
await asAuthor.authenticateAs({
email: 'author@example.org',
- password: '1234'
+ password: '1234',
})
await asAuthor.create('Post', {
id: 'p1',
- content: 'Old content'
+ content: 'Old content',
})
})
@@ -149,22 +152,22 @@ describe('DeletePost', () => {
`
let variables = {
- id: 'p1'
+ id: 'p1',
}
beforeEach(async () => {
const asAuthor = Factory()
await asAuthor.create('User', {
email: 'author@example.org',
- password: '1234'
+ password: '1234',
})
await asAuthor.authenticateAs({
email: 'author@example.org',
- password: '1234'
+ password: '1234',
})
await asAuthor.create('Post', {
id: 'p1',
- content: 'To be deleted'
+ content: 'To be deleted',
})
})
diff --git a/backend/src/resolvers/reports.js b/backend/src/resolvers/reports.js
index fb912a557..2c0fbfc75 100644
--- a/backend/src/resolvers/reports.js
+++ b/backend/src/resolvers/reports.js
@@ -7,11 +7,12 @@ export default {
const session = driver.session()
const reportData = {
id: reportId,
- createdAt: (new Date()).toISOString(),
- description: description
+ createdAt: new Date().toISOString(),
+ description: description,
}
- const res = await session.run(`
+ const res = await session.run(
+ `
MATCH (submitter:User {id: $userId})
MATCH (resource {id: $resourceId})
WHERE resource:User OR resource:Comment OR resource:Post
@@ -19,11 +20,12 @@ export default {
MERGE (resource)<-[:REPORTED]-(report)
MERGE (report)<-[:REPORTED]-(submitter)
RETURN report, submitter, resource, labels(resource)[0] as type
- `, {
- resourceId: id,
- userId: user.id,
- reportData
- }
+ `,
+ {
+ resourceId: id,
+ userId: user.id,
+ reportData,
+ },
)
session.close()
@@ -32,7 +34,7 @@ export default {
report: r.get('report'),
submitter: r.get('submitter'),
resource: r.get('resource'),
- type: r.get('type')
+ type: r.get('type'),
}
})
if (!dbResponse) return null
@@ -44,20 +46,20 @@ export default {
comment: null,
user: null,
submitter: submitter.properties,
- type
+ type,
}
switch (type) {
- case 'Post':
- response.post = resource.properties
- break
- case 'Comment':
- response.comment = resource.properties
- break
- case 'User':
- response.user = resource.properties
- break
+ case 'Post':
+ response.post = resource.properties
+ break
+ case 'Comment':
+ response.comment = resource.properties
+ break
+ case 'User':
+ response.user = resource.properties
+ break
}
return response
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/reports.spec.js b/backend/src/resolvers/reports.spec.js
index 9bd1fe753..19b5e6f9e 100644
--- a/backend/src/resolvers/reports.spec.js
+++ b/backend/src/resolvers/reports.spec.js
@@ -18,13 +18,13 @@ describe('report', () => {
await factory.create('User', {
id: 'u1',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
await factory.create('User', {
id: 'u2',
name: 'abusive-user',
role: 'user',
- email: 'abusive-user@example.org'
+ email: 'abusive-user@example.org',
})
})
@@ -59,7 +59,7 @@ describe('report', () => {
describe('invalid resource id', () => {
it('returns null', async () => {
await expect(action()).resolves.toEqual({
- report: null
+ report: null,
})
})
})
@@ -71,14 +71,14 @@ describe('report', () => {
it('creates a report', async () => {
await expect(action()).resolves.toEqual({
- report: { description: 'Violates code of conduct' }
+ report: { description: 'Violates code of conduct' },
})
})
it('returns the submitter', async () => {
returnedObject = '{ submitter { email } }'
await expect(action()).resolves.toEqual({
- report: { submitter: { email: 'test@example.org' } }
+ report: { submitter: { email: 'test@example.org' } },
})
})
@@ -86,14 +86,14 @@ describe('report', () => {
it('returns type "User"', async () => {
returnedObject = '{ type }'
await expect(action()).resolves.toEqual({
- report: { type: 'User' }
+ report: { type: 'User' },
})
})
it('returns resource in user attribute', async () => {
returnedObject = '{ user { name } }'
await expect(action()).resolves.toEqual({
- report: { user: { name: 'abusive-user' } }
+ report: { user: { name: 'abusive-user' } },
})
})
})
@@ -101,28 +101,31 @@ describe('report', () => {
describe('reported resource is a post', () => {
beforeEach(async () => {
await factory.authenticateAs({ email: 'test@example.org', password: '1234' })
- await factory.create('Post', { id: 'p23', title: 'Matt and Robert having a pair-programming' })
+ await factory.create('Post', {
+ id: 'p23',
+ title: 'Matt and Robert having a pair-programming',
+ })
variables = { id: 'p23' }
})
it('returns type "Post"', async () => {
returnedObject = '{ type }'
await expect(action()).resolves.toEqual({
- report: { type: 'Post' }
+ report: { type: 'Post' },
})
})
it('returns resource in post attribute', async () => {
returnedObject = '{ post { title } }'
await expect(action()).resolves.toEqual({
- report: { post: { title: 'Matt and Robert having a pair-programming' } }
+ report: { post: { title: 'Matt and Robert having a pair-programming' } },
})
})
it('returns null in user attribute', async () => {
returnedObject = '{ user { name } }'
await expect(action()).resolves.toEqual({
- report: { user: null }
+ report: { user: null },
})
})
})
@@ -132,25 +135,32 @@ describe('report', () => {
createPostVariables = {
id: 'p1',
title: 'post to comment on',
- content: 'please comment on me'
+ content: 'please comment on me',
}
- const asAuthenticatedUser = await factory.authenticateAs({ email: 'test@example.org', password: '1234' })
+ const asAuthenticatedUser = await factory.authenticateAs({
+ email: 'test@example.org',
+ password: '1234',
+ })
await asAuthenticatedUser.create('Post', createPostVariables)
- await asAuthenticatedUser.create('Comment', { postId: 'p1', id: 'c34', content: 'Robert getting tired.' })
+ await asAuthenticatedUser.create('Comment', {
+ postId: 'p1',
+ id: 'c34',
+ content: 'Robert getting tired.',
+ })
variables = { id: 'c34' }
})
it('returns type "Comment"', async () => {
returnedObject = '{ type }'
await expect(action()).resolves.toEqual({
- report: { type: 'Comment' }
+ report: { type: 'Comment' },
})
})
it('returns resource in comment attribute', async () => {
returnedObject = '{ comment { content } }'
await expect(action()).resolves.toEqual({
- report: { comment: { content: 'Robert getting tired.' } }
+ report: { comment: { content: 'Robert getting tired.' } },
})
})
})
diff --git a/backend/src/resolvers/rewards.js b/backend/src/resolvers/rewards.js
index a7a8c1ab7..ec5043da3 100644
--- a/backend/src/resolvers/rewards.js
+++ b/backend/src/resolvers/rewards.js
@@ -10,8 +10,8 @@ export default {
RETURN rewardedUser {.id}`,
{
badgeId: fromBadgeId,
- rewardedUserId: toUserId
- }
+ rewardedUserId: toUserId,
+ },
)
const [rewardedUser] = transactionRes.records.map(record => {
@@ -33,8 +33,8 @@ export default {
RETURN rewardedUser {.id}`,
{
badgeId: fromBadgeId,
- rewardedUserId: toUserId
- }
+ rewardedUserId: toUserId,
+ },
)
const [rewardedUser] = transactionRes.records.map(record => {
return record.get('rewardedUser')
@@ -42,6 +42,6 @@ export default {
session.close()
return rewardedUser.id
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/rewards.spec.js b/backend/src/resolvers/rewards.spec.js
index 567228eca..e2b67b25d 100644
--- a/backend/src/resolvers/rewards.spec.js
+++ b/backend/src/resolvers/rewards.spec.js
@@ -10,24 +10,24 @@ describe('rewards', () => {
id: 'u1',
role: 'user',
email: 'user@example.org',
- password: '1234'
+ password: '1234',
})
await factory.create('User', {
id: 'u2',
role: 'moderator',
- email: 'moderator@example.org'
+ email: 'moderator@example.org',
})
await factory.create('User', {
id: 'u3',
role: 'admin',
- email: 'admin@example.org'
+ email: 'admin@example.org',
})
await factory.create('Badge', {
id: 'b6',
key: 'indiegogo_en_rhino',
type: 'crowdfunding',
status: 'permanent',
- icon: '/img/badges/indiegogo_en_rhino.svg'
+ icon: '/img/badges/indiegogo_en_rhino.svg',
})
})
@@ -48,15 +48,13 @@ describe('rewards', () => {
describe('unauthenticated', () => {
const variables = {
from: 'b6',
- to: 'u1'
+ to: 'u1',
}
let client
it('throws authorization error', async () => {
client = new GraphQLClient(host)
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -70,14 +68,12 @@ describe('rewards', () => {
it('rewards a badge to user', async () => {
const variables = {
from: 'b6',
- to: 'u1'
+ to: 'u1',
}
const expected = {
- reward: 'u1'
+ reward: 'u1',
}
- await expect(
- client.request(mutation, variables)
- ).resolves.toEqual(expected)
+ await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
it('rewards a second different badge to same user', async () => {
await factory.create('Badge', {
@@ -85,41 +81,37 @@ describe('rewards', () => {
key: 'indiegogo_en_racoon',
type: 'crowdfunding',
status: 'permanent',
- icon: '/img/badges/indiegogo_en_racoon.svg'
+ icon: '/img/badges/indiegogo_en_racoon.svg',
})
const variables = {
from: 'b1',
- to: 'u1'
+ to: 'u1',
}
const expected = {
- reward: 'u1'
+ reward: 'u1',
}
- await expect(
- client.request(mutation, variables)
- ).resolves.toEqual(expected)
+ await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
it('rewards the same badge as well to another user', async () => {
const variables1 = {
from: 'b6',
- to: 'u1'
+ to: 'u1',
}
await client.request(mutation, variables1)
const variables2 = {
from: 'b6',
- to: 'u2'
+ to: 'u2',
}
const expected = {
- reward: 'u2'
+ reward: 'u2',
}
- await expect(
- client.request(mutation, variables2)
- ).resolves.toEqual(expected)
+ await expect(client.request(mutation, variables2)).resolves.toEqual(expected)
})
it('returns the original reward if a reward is attempted a second time', async () => {
const variables = {
from: 'b6',
- to: 'u1'
+ to: 'u1',
}
await client.request(mutation, variables)
await client.request(mutation, variables)
@@ -132,16 +124,14 @@ describe('rewards', () => {
`
const expected = { User: [{ badgesCount: 1 }] }
- await expect(
- client.request(query)
- ).resolves.toEqual(expected)
+ await expect(client.request(query)).resolves.toEqual(expected)
})
})
describe('authenticated moderator', () => {
const variables = {
from: 'b6',
- to: 'u1'
+ to: 'u1',
}
let client
beforeEach(async () => {
@@ -151,9 +141,7 @@ describe('rewards', () => {
describe('rewards bage to user', () => {
it('throws authorization error', async () => {
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
})
@@ -165,10 +153,10 @@ describe('rewards', () => {
})
const variables = {
from: 'b6',
- to: 'u1'
+ to: 'u1',
}
const expected = {
- unreward: 'u1'
+ unreward: 'u1',
}
const mutation = `
@@ -185,9 +173,7 @@ describe('rewards', () => {
it('throws authorization error', async () => {
client = new GraphQLClient(host)
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -199,17 +185,15 @@ describe('rewards', () => {
})
it('removes a badge from user', async () => {
- await expect(
- client.request(mutation, variables)
- ).resolves.toEqual(expected)
+ await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
it('fails to remove a not existing badge from user', async () => {
await client.request(mutation, variables)
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Cannot read property \'id\' of undefined')
+ await expect(client.request(mutation, variables)).rejects.toThrow(
+ "Cannot read property 'id' of undefined",
+ )
})
})
@@ -222,9 +206,7 @@ describe('rewards', () => {
describe('removes bage from user', () => {
it('throws authorization error', async () => {
- await expect(
- client.request(mutation, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutation, variables)).rejects.toThrow('Not Authorised')
})
})
})
diff --git a/backend/src/resolvers/shout.js b/backend/src/resolvers/shout.js
index 69c39a3a9..d2d7f652e 100644
--- a/backend/src/resolvers/shout.js
+++ b/backend/src/resolvers/shout.js
@@ -12,8 +12,8 @@ export default {
{
id,
type,
- userId: context.user.id
- }
+ userId: context.user.id,
+ },
)
const [isShouted] = transactionRes.records.map(record => {
@@ -37,8 +37,8 @@ export default {
{
id,
type,
- userId: context.user.id
- }
+ userId: context.user.id,
+ },
)
const [isShouted] = transactionRes.records.map(record => {
return record.get('isShouted')
@@ -46,6 +46,6 @@ export default {
session.close()
return isShouted
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/shout.spec.js b/backend/src/resolvers/shout.spec.js
index 88866a74f..46570efa0 100644
--- a/backend/src/resolvers/shout.spec.js
+++ b/backend/src/resolvers/shout.spec.js
@@ -6,12 +6,12 @@ const factory = Factory()
let clientUser1, clientUser2
let headersUser1, headersUser2
-const mutationShoutPost = (id) => `
+const mutationShoutPost = id => `
mutation {
shout(id: "${id}", type: Post)
}
`
-const mutationUnshoutPost = (id) => `
+const mutationUnshoutPost = id => `
mutation {
unshout(id: "${id}", type: Post)
}
@@ -21,12 +21,12 @@ beforeEach(async () => {
await factory.create('User', {
id: 'u1',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
await factory.create('User', {
id: 'u2',
email: 'test2@example.org',
- password: '1234'
+ password: '1234',
})
headersUser1 = await login({ email: 'test@example.org', password: '1234' })
@@ -62,18 +62,14 @@ describe('shout', () => {
it('throws authorization error', async () => {
let client
client = new GraphQLClient(host)
- await expect(
- client.request(mutationShoutPost('p1'))
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutationShoutPost('p1'))).rejects.toThrow('Not Authorised')
})
})
it('I shout a post of another user', async () => {
- const res = await clientUser1.request(
- mutationShoutPost('p2')
- )
+ const res = await clientUser1.request(mutationShoutPost('p2'))
const expected = {
- shout: true
+ shout: true,
}
expect(res).toMatchObject(expected)
@@ -83,17 +79,15 @@ describe('shout', () => {
}
}`)
const expected2 = {
- shoutedByCurrentUser: true
+ shoutedByCurrentUser: true,
}
expect(Post[0]).toMatchObject(expected2)
})
it('I can`t shout my own post', async () => {
- const res = await clientUser1.request(
- mutationShoutPost('p1')
- )
+ const res = await clientUser1.request(mutationShoutPost('p1'))
const expected = {
- shout: false
+ shout: false,
}
expect(res).toMatchObject(expected)
@@ -103,7 +97,7 @@ describe('shout', () => {
}
}`)
const expected2 = {
- shoutedByCurrentUser: false
+ shoutedByCurrentUser: false,
}
expect(Post[0]).toMatchObject(expected2)
})
@@ -113,25 +107,19 @@ describe('shout', () => {
describe('unauthenticated shout', () => {
it('throws authorization error', async () => {
// shout
- await clientUser1.request(
- mutationShoutPost('p2')
- )
+ await clientUser1.request(mutationShoutPost('p2'))
// unshout
let client
client = new GraphQLClient(host)
- await expect(
- client.request(mutationUnshoutPost('p2'))
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutationUnshoutPost('p2'))).rejects.toThrow('Not Authorised')
})
})
it('I unshout a post of another user', async () => {
// shout
- await clientUser1.request(
- mutationShoutPost('p2')
- )
+ await clientUser1.request(mutationShoutPost('p2'))
const expected = {
- unshout: true
+ unshout: true,
}
// unshout
const res = await clientUser1.request(mutationUnshoutPost('p2'))
@@ -143,7 +131,7 @@ describe('shout', () => {
}
}`)
const expected2 = {
- shoutedByCurrentUser: false
+ shoutedByCurrentUser: false,
}
expect(Post[0]).toMatchObject(expected2)
})
diff --git a/backend/src/resolvers/socialMedia.js b/backend/src/resolvers/socialMedia.js
index ef143a478..0bc03ea74 100644
--- a/backend/src/resolvers/socialMedia.js
+++ b/backend/src/resolvers/socialMedia.js
@@ -5,16 +5,17 @@ export default {
CreateSocialMedia: async (object, params, context, resolveInfo) => {
/**
* TODO?: Creates double Nodes!
- */
+ */
const socialMedia = await neo4jgraphql(object, params, context, resolveInfo, false)
const session = context.driver.session()
await session.run(
`MATCH (owner:User {id: $userId}), (socialMedia:SocialMedia {id: $socialMediaId})
MERGE (socialMedia)<-[:OWNED]-(owner)
- RETURN owner`, {
+ RETURN owner`,
+ {
userId: context.user.id,
- socialMediaId: socialMedia.id
- }
+ socialMediaId: socialMedia.id,
+ },
)
session.close()
@@ -24,6 +25,6 @@ export default {
const socialMedia = await neo4jgraphql(object, params, context, resolveInfo, false)
return socialMedia
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/socialMedia.spec.js b/backend/src/resolvers/socialMedia.spec.js
index 9d1d76726..5143587b1 100644
--- a/backend/src/resolvers/socialMedia.spec.js
+++ b/backend/src/resolvers/socialMedia.spec.js
@@ -31,7 +31,7 @@ describe('CreateSocialMedia', () => {
slug: 'matilde-hermiston',
role: 'user',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -43,9 +43,7 @@ describe('CreateSocialMedia', () => {
it('throws authorization error', async () => {
client = new GraphQLClient(host)
const variables = { url: 'http://nsosp.org' }
- await expect(
- client.request(mutationC, variables)
- ).rejects.toThrow('Not Authorised')
+ await expect(client.request(mutationC, variables)).rejects.toThrow('Not Authorised')
})
})
@@ -57,14 +55,14 @@ describe('CreateSocialMedia', () => {
it('creates social media with correct URL', async () => {
const variables = { url: 'http://nsosp.org' }
- await expect(
- client.request(mutationC, variables)
- ).resolves.toEqual(expect.objectContaining({
- CreateSocialMedia: {
- id: expect.any(String),
- url: 'http://nsosp.org'
- }
- }))
+ await expect(client.request(mutationC, variables)).resolves.toEqual(
+ expect.objectContaining({
+ CreateSocialMedia: {
+ id: expect.any(String),
+ url: 'http://nsosp.org',
+ },
+ }),
+ )
})
it('deletes social media', async () => {
@@ -76,26 +74,20 @@ describe('CreateSocialMedia', () => {
const expected = {
DeleteSocialMedia: {
id: id,
- url: 'http://nsosp.org'
- }
+ url: 'http://nsosp.org',
+ },
}
- await expect(
- client.request(mutationD, deletionVariables)
- ).resolves.toEqual(expected)
+ await expect(client.request(mutationD, deletionVariables)).resolves.toEqual(expected)
})
it('rejects empty string', async () => {
const variables = { url: '' }
- await expect(
- client.request(mutationC, variables)
- ).rejects.toThrow('Input is not a URL')
+ await expect(client.request(mutationC, variables)).rejects.toThrow('Input is not a URL')
})
it('validates URLs', async () => {
const variables = { url: 'not-a-url' }
- await expect(
- client.request(mutationC, variables)
- ).rejects.toThrow('Input is not a URL')
+ await expect(client.request(mutationC, variables)).rejects.toThrow('Input is not a URL')
})
})
})
diff --git a/backend/src/resolvers/statistics.js b/backend/src/resolvers/statistics.js
index 17c4be956..f09b7219d 100644
--- a/backend/src/resolvers/statistics.js
+++ b/backend/src/resolvers/statistics.js
@@ -1,24 +1,22 @@
export const query = (cypher, session) => {
return new Promise((resolve, reject) => {
let data = []
- session
- .run(cypher)
- .subscribe({
- onNext: function (record) {
- let item = {}
- record.keys.forEach(key => {
- item[key] = record.get(key)
- })
- data.push(item)
- },
- onCompleted: function () {
- session.close()
- resolve(data)
- },
- onError: function (error) {
- reject(error)
- }
- })
+ session.run(cypher).subscribe({
+ onNext: function(record) {
+ let item = {}
+ record.keys.forEach(key => {
+ item[key] = record.get(key)
+ })
+ data.push(item)
+ },
+ onCompleted: function() {
+ session.close()
+ resolve(data)
+ },
+ onError: function(error) {
+ reject(error)
+ },
+ })
})
}
const queryOne = (cypher, session) => {
@@ -36,32 +34,41 @@ const queryOne = (cypher, session) => {
export default {
Query: {
statistics: async (parent, args, { driver, user }) => {
- return new Promise(async (resolve) => {
+ return new Promise(async resolve => {
const session = driver.session()
const queries = {
- countUsers: 'MATCH (r:User) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countUsers',
- countPosts: 'MATCH (r:Post) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countPosts',
- countComments: 'MATCH (r:Comment) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countComments',
- countNotifications: 'MATCH (r:Notification) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countNotifications',
- countOrganizations: 'MATCH (r:Organization) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countOrganizations',
- countProjects: 'MATCH (r:Project) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countProjects',
- countInvites: 'MATCH (r:Invite) WHERE r.wasUsed <> true OR NOT exists(r.wasUsed) RETURN COUNT(r) AS countInvites',
+ countUsers:
+ 'MATCH (r:User) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countUsers',
+ countPosts:
+ 'MATCH (r:Post) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countPosts',
+ countComments:
+ 'MATCH (r:Comment) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countComments',
+ countNotifications:
+ 'MATCH (r:Notification) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countNotifications',
+ countOrganizations:
+ 'MATCH (r:Organization) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countOrganizations',
+ countProjects:
+ 'MATCH (r:Project) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countProjects',
+ countInvites:
+ 'MATCH (r:Invite) WHERE r.wasUsed <> true OR NOT exists(r.wasUsed) RETURN COUNT(r) AS countInvites',
countFollows: 'MATCH (:User)-[r:FOLLOWS]->(:User) RETURN COUNT(r) AS countFollows',
- countShouts: 'MATCH (:User)-[r:SHOUTED]->(:Post) RETURN COUNT(r) AS countShouts'
+ countShouts: 'MATCH (:User)-[r:SHOUTED]->(:Post) RETURN COUNT(r) AS countShouts',
}
let data = {
countUsers: (await queryOne(queries.countUsers, session)).countUsers.low,
countPosts: (await queryOne(queries.countPosts, session)).countPosts.low,
countComments: (await queryOne(queries.countComments, session)).countComments.low,
- countNotifications: (await queryOne(queries.countNotifications, session)).countNotifications.low,
- countOrganizations: (await queryOne(queries.countOrganizations, session)).countOrganizations.low,
+ countNotifications: (await queryOne(queries.countNotifications, session))
+ .countNotifications.low,
+ countOrganizations: (await queryOne(queries.countOrganizations, session))
+ .countOrganizations.low,
countProjects: (await queryOne(queries.countProjects, session)).countProjects.low,
countInvites: (await queryOne(queries.countInvites, session)).countInvites.low,
countFollows: (await queryOne(queries.countFollows, session)).countFollows.low,
- countShouts: (await queryOne(queries.countShouts, session)).countShouts.low
+ countShouts: (await queryOne(queries.countShouts, session)).countShouts.low,
}
resolve(data)
})
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/user_management.js b/backend/src/resolvers/user_management.js
index 26dfb81db..e2fd5acf1 100644
--- a/backend/src/resolvers/user_management.js
+++ b/backend/src/resolvers/user_management.js
@@ -12,7 +12,7 @@ export default {
const { user } = ctx
if (!user) return null
return neo4jgraphql(object, { id: user.id }, ctx, resolveInfo, false)
- }
+ },
},
Mutation: {
signup: async (parent, { email, password }, { req }) => {
@@ -34,12 +34,12 @@ export default {
'MATCH (user:User {email: $userEmail}) ' +
'RETURN user {.id, .slug, .name, .avatar, .email, .password, .role, .disabled} as user LIMIT 1',
{
- userEmail: email
- }
+ userEmail: email,
+ },
)
session.close()
- const [currentUser] = await result.records.map(function (record) {
+ const [currentUser] = await result.records.map(function(record) {
return record.get('user')
})
@@ -50,29 +50,23 @@ export default {
) {
delete currentUser.password
return encode(currentUser)
- } else if (currentUser &&
- currentUser.disabled
- ) {
+ } else if (currentUser && currentUser.disabled) {
throw new AuthenticationError('Your account has been disabled.')
} else {
throw new AuthenticationError('Incorrect email address or password.')
}
},
- changePassword: async (
- _,
- { oldPassword, newPassword },
- { driver, user }
- ) => {
+ changePassword: async (_, { oldPassword, newPassword }, { driver, user }) => {
const session = driver.session()
let result = await session.run(
`MATCH (user:User {email: $userEmail})
RETURN user {.id, .email, .password}`,
{
- userEmail: user.email
- }
+ userEmail: user.email,
+ },
)
- const [currentUser] = result.records.map(function (record) {
+ const [currentUser] = result.records.map(function(record) {
return record.get('user')
})
@@ -81,9 +75,7 @@ export default {
}
if (await bcrypt.compareSync(newPassword, currentUser.password)) {
- throw new AuthenticationError(
- 'Old password and new password should be different'
- )
+ throw new AuthenticationError('Old password and new password should be different')
} else {
const newHashedPassword = await bcrypt.hashSync(newPassword, 10)
session.run(
@@ -93,13 +85,13 @@ export default {
`,
{
userEmail: user.email,
- newHashedPassword
- }
+ newHashedPassword,
+ },
)
session.close()
return encode(currentUser)
}
- }
- }
+ },
+ },
}
diff --git a/backend/src/resolvers/user_management.spec.js b/backend/src/resolvers/user_management.spec.js
index 7c0be08f3..9dff9e388 100644
--- a/backend/src/resolvers/user_management.spec.js
+++ b/backend/src/resolvers/user_management.spec.js
@@ -24,10 +24,10 @@ const factory = Factory()
// }
const jennyRostocksHeaders = {
authorization:
- 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsImxvY2F0aW9uTmFtZSI6bnVsbCwibmFtZSI6Ikplbm55IFJvc3RvY2siLCJhYm91dCI6bnVsbCwiYXZhdGFyIjoiaHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci9zYXNoYV9zaGVzdGFrb3YvMTI4LmpwZyIsImlkIjoidTMiLCJlbWFpbCI6InVzZXJAZXhhbXBsZS5vcmciLCJzbHVnIjoiamVubnktcm9zdG9jayIsImlhdCI6MTU1MDg0NjY4MCwiZXhwIjoxNjM3MjQ2NjgwLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjQwMDAiLCJzdWIiOiJ1MyJ9.eZ_mVKas4Wzoc_JrQTEWXyRn7eY64cdIg4vqQ-F_7Jc'
+ 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsImxvY2F0aW9uTmFtZSI6bnVsbCwibmFtZSI6Ikplbm55IFJvc3RvY2siLCJhYm91dCI6bnVsbCwiYXZhdGFyIjoiaHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci9zYXNoYV9zaGVzdGFrb3YvMTI4LmpwZyIsImlkIjoidTMiLCJlbWFpbCI6InVzZXJAZXhhbXBsZS5vcmciLCJzbHVnIjoiamVubnktcm9zdG9jayIsImlhdCI6MTU1MDg0NjY4MCwiZXhwIjoxNjM3MjQ2NjgwLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjQwMDAiLCJzdWIiOiJ1MyJ9.eZ_mVKas4Wzoc_JrQTEWXyRn7eY64cdIg4vqQ-F_7Jc',
}
-const disable = async (id) => {
+const disable = async id => {
const moderatorParams = { email: 'moderator@example.org', role: 'moderator', password: '1234' }
const asModerator = Factory()
await asModerator.create('User', moderatorParams)
@@ -43,7 +43,7 @@ beforeEach(async () => {
slug: 'matilde-hermiston',
role: 'user',
email: 'test@example.org',
- password: '1234'
+ password: '1234',
})
})
@@ -56,7 +56,7 @@ describe('isLoggedIn', () => {
describe('unauthenticated', () => {
it('returns false', async () => {
await expect(request(host, query)).resolves.toEqual({
- isLoggedIn: false
+ isLoggedIn: false,
})
})
})
@@ -67,7 +67,7 @@ describe('isLoggedIn', () => {
it('returns false', async () => {
await expect(client.request(query)).resolves.toEqual({
- isLoggedIn: false
+ isLoggedIn: false,
})
})
})
@@ -77,7 +77,7 @@ describe('isLoggedIn', () => {
it('returns false', async () => {
await expect(client.request(query)).resolves.toEqual({
- isLoggedIn: false
+ isLoggedIn: false,
})
})
@@ -87,7 +87,7 @@ describe('isLoggedIn', () => {
// see the decoded token above
await factory.create('User', { id: 'u3' })
await expect(client.request(query)).resolves.toEqual({
- isLoggedIn: true
+ isLoggedIn: true,
})
})
})
@@ -100,7 +100,7 @@ describe('isLoggedIn', () => {
it('returns false', async () => {
await expect(client.request(query)).resolves.toEqual({
- isLoggedIn: false
+ isLoggedIn: false,
})
})
})
@@ -156,8 +156,8 @@ describe('currentUser', () => {
id: 'acb2d923-f3af-479e-9f00-61b12e864666',
name: 'Matilde Hermiston',
slug: 'matilde-hermiston',
- role: 'user'
- }
+ role: 'user',
+ },
}
await expect(client.request(query)).resolves.toEqual(expected)
})
@@ -181,8 +181,8 @@ describe('login', () => {
host,
mutation({
email: 'test@example.org',
- password: '1234'
- })
+ password: '1234',
+ }),
)
const token = data.login
jwt.verify(token, process.env.JWT_SECRET, (err, data) => {
@@ -200,9 +200,9 @@ describe('login', () => {
host,
mutation({
email: 'test@example.org',
- password: '1234'
- })
- )
+ password: '1234',
+ }),
+ ),
).rejects.toThrow('Your account has been disabled.')
})
})
@@ -214,9 +214,9 @@ describe('login', () => {
host,
mutation({
email: 'test@example.org',
- password: 'wrong'
- })
- )
+ password: 'wrong',
+ }),
+ ),
).rejects.toThrow('Incorrect email address or password.')
})
})
@@ -228,9 +228,9 @@ describe('login', () => {
host,
mutation({
email: 'non-existent@example.org',
- password: 'wrong'
- })
- )
+ password: 'wrong',
+ }),
+ ),
).rejects.toThrow('Incorrect email address or password.')
})
})
@@ -261,9 +261,9 @@ describe('change password', () => {
host,
mutation({
oldPassword: '1234',
- newPassword: '1234'
- })
- )
+ newPassword: '1234',
+ }),
+ ),
).rejects.toThrow('Not Authorised!')
})
})
@@ -274,9 +274,9 @@ describe('change password', () => {
client.request(
mutation({
oldPassword: '1234',
- newPassword: '1234'
- })
- )
+ newPassword: '1234',
+ }),
+ ),
).rejects.toThrow('Old password and new password should be different')
})
})
@@ -287,9 +287,9 @@ describe('change password', () => {
client.request(
mutation({
oldPassword: 'notOldPassword',
- newPassword: '12345'
- })
- )
+ newPassword: '12345',
+ }),
+ ),
).rejects.toThrow('Old password is not correct')
})
})
@@ -299,14 +299,14 @@ describe('change password', () => {
let response = await client.request(
mutation({
oldPassword: '1234',
- newPassword: '12345'
- })
+ newPassword: '12345',
+ }),
+ )
+ await expect(response).toEqual(
+ expect.objectContaining({
+ changePassword: expect.any(String),
+ }),
)
- await expect(
- response
- ).toEqual(expect.objectContaining({
- changePassword: expect.any(String)
- }))
})
})
})
@@ -320,14 +320,16 @@ describe('do not expose private RSA key', () => {
id
publicKey
}
- }`
+ }
+ `
const queryUserPrivateKey = gql`
query($queriedUserSlug: String) {
User(slug: $queriedUserSlug) {
id
privateKey
}
- }`
+ }
+ `
const actionGenUserWithKeys = async () => {
// Generate user with "privateKey" via 'CreateUser' mutation instead of using the factories "factory.create('User', {...})", see above.
@@ -336,14 +338,17 @@ describe('do not expose private RSA key', () => {
password: 'xYz',
slug: 'apfel-strudel',
name: 'Apfel Strudel',
- email: 'apfel-strudel@test.org'
+ email: 'apfel-strudel@test.org',
}
- await client.request(gql`
- mutation($id: ID, $password: String!, $slug: String, $name: String, $email: String!) {
- CreateUser(id: $id, password: $password, slug: $slug, name: $name, email: $email) {
- id
+ await client.request(
+ gql`
+ mutation($id: ID, $password: String!, $slug: String, $name: String, $email: String!) {
+ CreateUser(id: $id, password: $password, slug: $slug, name: $name, email: $email) {
+ id
+ }
}
- }`, variables
+ `,
+ variables,
)
}
@@ -356,13 +361,17 @@ describe('do not expose private RSA key', () => {
it('returns publicKey', async () => {
await actionGenUserWithKeys()
await expect(
- await client.request(queryUserPuplicKey, { queriedUserSlug: 'apfel-strudel' })
- ).toEqual(expect.objectContaining({
- User: [{
- id: 'bcb2d923-f3af-479e-9f00-61b12e864667',
- publicKey: expect.any(String)
- }]
- }))
+ await client.request(queryUserPuplicKey, { queriedUserSlug: 'apfel-strudel' }),
+ ).toEqual(
+ expect.objectContaining({
+ User: [
+ {
+ id: 'bcb2d923-f3af-479e-9f00-61b12e864667',
+ publicKey: expect.any(String),
+ },
+ ],
+ }),
+ )
})
})
@@ -370,7 +379,7 @@ describe('do not expose private RSA key', () => {
it('throws "Not Authorised!"', async () => {
await actionGenUserWithKeys()
await expect(
- client.request(queryUserPrivateKey, { queriedUserSlug: 'apfel-strudel' })
+ client.request(queryUserPrivateKey, { queriedUserSlug: 'apfel-strudel' }),
).rejects.toThrow('Not Authorised')
})
})
@@ -385,13 +394,17 @@ describe('do not expose private RSA key', () => {
it('returns publicKey', async () => {
await actionGenUserWithKeys()
await expect(
- await client.request(queryUserPuplicKey, { queriedUserSlug: 'apfel-strudel' })
- ).toEqual(expect.objectContaining({
- User: [{
- id: 'bcb2d923-f3af-479e-9f00-61b12e864667',
- publicKey: expect.any(String)
- }]
- }))
+ await client.request(queryUserPuplicKey, { queriedUserSlug: 'apfel-strudel' }),
+ ).toEqual(
+ expect.objectContaining({
+ User: [
+ {
+ id: 'bcb2d923-f3af-479e-9f00-61b12e864667',
+ publicKey: expect.any(String),
+ },
+ ],
+ }),
+ )
})
})
@@ -399,7 +412,7 @@ describe('do not expose private RSA key', () => {
it('throws "Not Authorised!"', async () => {
await actionGenUserWithKeys()
await expect(
- client.request(queryUserPrivateKey, { queriedUserSlug: 'apfel-strudel' })
+ client.request(queryUserPrivateKey, { queriedUserSlug: 'apfel-strudel' }),
).rejects.toThrow('Not Authorised')
})
})
diff --git a/backend/src/resolvers/users.spec.js b/backend/src/resolvers/users.spec.js
index 48e4741d7..bf55784fd 100644
--- a/backend/src/resolvers/users.spec.js
+++ b/backend/src/resolvers/users.spec.js
@@ -24,15 +24,14 @@ describe('users', () => {
const variables = {
name: 'John Doe',
password: '123',
- email: '123@123.de'
+ email: '123@123.de',
}
const expected = {
CreateUser: {
- id: expect.any(String)
- }
+ id: expect.any(String),
+ },
}
- await expect(client.request(mutation, variables))
- .resolves.toEqual(expected)
+ await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
})
@@ -54,35 +53,32 @@ describe('users', () => {
it('name within specifications', async () => {
const variables = {
id: 'u47',
- name: 'James Doe'
+ name: 'James Doe',
}
const expected = {
UpdateUser: {
id: 'u47',
- name: 'James Doe'
- }
+ name: 'James Doe',
+ },
}
- await expect(client.request(mutation, variables))
- .resolves.toEqual(expected)
+ await expect(client.request(mutation, variables)).resolves.toEqual(expected)
})
it('with no name', async () => {
const variables = {
- id: 'u47'
+ id: 'u47',
}
const expected = 'Username must be at least 3 characters long!'
- await expect(client.request(mutation, variables))
- .rejects.toThrow(expected)
+ await expect(client.request(mutation, variables)).rejects.toThrow(expected)
})
it('with too short name', async () => {
const variables = {
id: 'u47',
- name: ' '
+ name: ' ',
}
const expected = 'Username must be at least 3 characters long!'
- await expect(client.request(mutation, variables))
- .rejects.toThrow(expected)
+ await expect(client.request(mutation, variables)).rejects.toThrow(expected)
})
})
})
diff --git a/backend/src/seed/factories/badges.js b/backend/src/seed/factories/badges.js
index 6f5f8d69a..52fa9da33 100644
--- a/backend/src/seed/factories/badges.js
+++ b/backend/src/seed/factories/badges.js
@@ -1,12 +1,12 @@
import uuid from 'uuid/v4'
-export default function (params) {
+export default function(params) {
const {
id = uuid(),
key = '',
type = 'crowdfunding',
status = 'permanent',
- icon = '/img/badges/indiegogo_en_panda.svg'
+ icon = '/img/badges/indiegogo_en_panda.svg',
} = params
return {
@@ -23,6 +23,6 @@ export default function (params) {
}
}
`,
- variables: { id, key, type, status, icon }
+ variables: { id, key, type, status, icon },
}
}
diff --git a/backend/src/seed/factories/categories.js b/backend/src/seed/factories/categories.js
index 5c1b3ce10..341f1b1fd 100644
--- a/backend/src/seed/factories/categories.js
+++ b/backend/src/seed/factories/categories.js
@@ -1,12 +1,7 @@
import uuid from 'uuid/v4'
-export default function (params) {
- const {
- id = uuid(),
- name,
- slug,
- icon
- } = params
+export default function(params) {
+ const { id = uuid(), name, slug, icon } = params
return {
mutation: `
@@ -17,6 +12,6 @@ export default function (params) {
}
}
`,
- variables: { id, name, slug, icon }
+ variables: { id, name, slug, icon },
}
}
diff --git a/backend/src/seed/factories/comments.js b/backend/src/seed/factories/comments.js
index ba3a85840..b1079e392 100644
--- a/backend/src/seed/factories/comments.js
+++ b/backend/src/seed/factories/comments.js
@@ -1,14 +1,11 @@
import faker from 'faker'
import uuid from 'uuid/v4'
-export default function (params) {
+export default function(params) {
const {
id = uuid(),
postId = 'p6',
- content = [
- faker.lorem.sentence(),
- faker.lorem.sentence()
- ].join('. ')
+ content = [faker.lorem.sentence(), faker.lorem.sentence()].join('. '),
} = params
return {
@@ -19,6 +16,6 @@ export default function (params) {
}
}
`,
- variables: { id, postId, content }
+ variables: { id, postId, content },
}
}
diff --git a/backend/src/seed/factories/index.js b/backend/src/seed/factories/index.js
index a0cb310ab..211edf87e 100644
--- a/backend/src/seed/factories/index.js
+++ b/backend/src/seed/factories/index.js
@@ -19,7 +19,7 @@ const authenticatedHeaders = async ({ email, password }, host) => {
}`
const response = await request(host, mutation)
return {
- authorization: `Bearer ${response.login}`
+ authorization: `Bearer ${response.login}`,
}
}
const factories = {
@@ -31,7 +31,7 @@ const factories = {
Category: createCategory,
Tag: createTag,
Report: createReport,
- Notification: createNotification
+ Notification: createNotification,
}
export const cleanDatabase = async (options = {}) => {
@@ -47,11 +47,8 @@ export const cleanDatabase = async (options = {}) => {
}
}
-export default function Factory (options = {}) {
- const {
- neo4jDriver = getDriver(),
- seedServerHost = 'http://127.0.0.1:4001'
- } = options
+export default function Factory(options = {}) {
+ const { neo4jDriver = getDriver(), seedServerHost = 'http://127.0.0.1:4001' } = options
const graphQLClient = new GraphQLClient(seedServerHost)
@@ -61,21 +58,18 @@ export default function Factory (options = {}) {
graphQLClient,
factories,
lastResponse: null,
- async authenticateAs ({ email, password }) {
- const headers = await authenticatedHeaders(
- { email, password },
- seedServerHost
- )
+ async authenticateAs({ email, password }) {
+ const headers = await authenticatedHeaders({ email, password }, seedServerHost)
this.lastResponse = headers
this.graphQLClient = new GraphQLClient(seedServerHost, { headers })
return this
},
- async create (node, properties) {
+ async create(node, properties) {
const { mutation, variables } = this.factories[node](properties)
this.lastResponse = await this.graphQLClient.request(mutation, variables)
return this
},
- async relate (node, relationship, properties) {
+ async relate(node, relationship, properties) {
const { from, to } = properties
const mutation = `
mutation {
@@ -88,11 +82,11 @@ export default function Factory (options = {}) {
this.lastResponse = await this.graphQLClient.request(mutation)
return this
},
- async mutate (mutation, variables) {
+ async mutate(mutation, variables) {
this.lastResponse = await this.graphQLClient.request(mutation, variables)
return this
},
- async shout (properties) {
+ async shout(properties) {
const { id, type } = properties
const mutation = `
mutation {
@@ -105,7 +99,7 @@ export default function Factory (options = {}) {
this.lastResponse = await this.graphQLClient.request(mutation)
return this
},
- async follow (properties) {
+ async follow(properties) {
const { id, type } = properties
const mutation = `
mutation {
@@ -118,10 +112,10 @@ export default function Factory (options = {}) {
this.lastResponse = await this.graphQLClient.request(mutation)
return this
},
- async cleanDatabase () {
+ async cleanDatabase() {
this.lastResponse = await cleanDatabase({ driver: this.neo4jDriver })
return this
- }
+ },
}
result.authenticateAs.bind(result)
result.create.bind(result)
diff --git a/backend/src/seed/factories/notifications.js b/backend/src/seed/factories/notifications.js
index f7797200f..d14d4294a 100644
--- a/backend/src/seed/factories/notifications.js
+++ b/backend/src/seed/factories/notifications.js
@@ -1,10 +1,7 @@
import uuid from 'uuid/v4'
-export default function (params) {
- const {
- id = uuid(),
- read = false
- } = params
+export default function(params) {
+ const { id = uuid(), read = false } = params
return {
mutation: `
@@ -15,6 +12,6 @@ export default function (params) {
}
}
`,
- variables: { id, read }
+ variables: { id, read },
}
}
diff --git a/backend/src/seed/factories/organizations.js b/backend/src/seed/factories/organizations.js
index dd4100b26..536de1597 100644
--- a/backend/src/seed/factories/organizations.js
+++ b/backend/src/seed/factories/organizations.js
@@ -1,11 +1,11 @@
import faker from 'faker'
import uuid from 'uuid/v4'
-export default function create (params) {
+export default function create(params) {
const {
id = uuid(),
name = faker.company.companyName(),
- description = faker.company.catchPhrase()
+ description = faker.company.catchPhrase(),
} = params
return {
@@ -16,6 +16,6 @@ export default function create (params) {
}
}
`,
- variables: { id, name, description }
+ variables: { id, name, description },
}
}
diff --git a/backend/src/seed/factories/posts.js b/backend/src/seed/factories/posts.js
index cbc73dbf8..1468b05d7 100644
--- a/backend/src/seed/factories/posts.js
+++ b/backend/src/seed/factories/posts.js
@@ -1,7 +1,7 @@
import faker from 'faker'
import uuid from 'uuid/v4'
-export default function (params) {
+export default function(params) {
const {
id = uuid(),
slug = '',
@@ -11,11 +11,11 @@ export default function (params) {
faker.lorem.sentence(),
faker.lorem.sentence(),
faker.lorem.sentence(),
- faker.lorem.sentence()
+ faker.lorem.sentence(),
].join('. '),
image = faker.image.image(),
visibility = 'public',
- deleted = false
+ deleted = false,
} = params
return {
@@ -43,6 +43,6 @@ export default function (params) {
}
}
`,
- variables: { id, slug, title, content, image, visibility, deleted }
+ variables: { id, slug, title, content, image, visibility, deleted },
}
}
diff --git a/backend/src/seed/factories/reports.js b/backend/src/seed/factories/reports.js
index 130c20c37..40d0e6179 100644
--- a/backend/src/seed/factories/reports.js
+++ b/backend/src/seed/factories/reports.js
@@ -1,10 +1,7 @@
import faker from 'faker'
-export default function create (params) {
- const {
- description = faker.lorem.sentence(),
- id
- } = params
+export default function create(params) {
+ const { description = faker.lorem.sentence(), id } = params
return {
mutation: `
@@ -15,6 +12,6 @@ export default function create (params) {
}
}
`,
- variables: { id, description }
+ variables: { id, description },
}
}
diff --git a/backend/src/seed/factories/tags.js b/backend/src/seed/factories/tags.js
index 558b68957..15ded1986 100644
--- a/backend/src/seed/factories/tags.js
+++ b/backend/src/seed/factories/tags.js
@@ -1,10 +1,7 @@
import uuid from 'uuid/v4'
-export default function (params) {
- const {
- id = uuid(),
- name = '#human-connection'
- } = params
+export default function(params) {
+ const { id = uuid(), name = '#human-connection' } = params
return {
mutation: `
@@ -14,6 +11,6 @@ export default function (params) {
}
}
`,
- variables: { id, name }
+ variables: { id, name },
}
}
diff --git a/backend/src/seed/factories/users.js b/backend/src/seed/factories/users.js
index a088b4c54..1ab362ce2 100644
--- a/backend/src/seed/factories/users.js
+++ b/backend/src/seed/factories/users.js
@@ -1,7 +1,7 @@
import faker from 'faker'
import uuid from 'uuid/v4'
-export default function create (params) {
+export default function create(params) {
const {
id = uuid(),
name = faker.name.findName(),
@@ -10,7 +10,7 @@ export default function create (params) {
password = '1234',
role = 'user',
avatar = faker.internet.avatar(),
- about = faker.lorem.paragraph()
+ about = faker.lorem.paragraph(),
} = params
return {
@@ -46,6 +46,6 @@ export default function create (params) {
}
}
`,
- variables: { id, name, slug, password, email, avatar, about, role }
+ variables: { id, name, slug, password, email, avatar, about, role },
}
}
diff --git a/backend/src/seed/reset-db.js b/backend/src/seed/reset-db.js
index 4075489f9..3197a6e18 100644
--- a/backend/src/seed/reset-db.js
+++ b/backend/src/seed/reset-db.js
@@ -7,13 +7,13 @@ if (process.env.NODE_ENV === 'production') {
throw new Error(`YOU CAN'T CLEAN THE DATABASE WITH NODE_ENV=${process.env.NODE_ENV}`)
}
-(async function () {
+;(async function() {
try {
await cleanDatabase()
- console.log('Successfully deleted all nodes and relations!')
+ console.log('Successfully deleted all nodes and relations!') // eslint-disable-line no-console
process.exit(0)
} catch (err) {
- console.log(`Error occurred deleting the nodes and relations (reset the db)\n\n${err}`)
+ console.log(`Error occurred deleting the nodes and relations (reset the db)\n\n${err}`) // eslint-disable-line no-console
process.exit(1)
}
})()
diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js
index 8694a7948..27af1106a 100644
--- a/backend/src/seed/seed-db.js
+++ b/backend/src/seed/seed-db.js
@@ -2,126 +2,247 @@ import faker from 'faker'
import Factory from './factories'
/* eslint-disable no-multi-spaces */
-(async function () {
+;(async function() {
try {
const f = Factory()
await Promise.all([
- f.create('Badge', { id: 'b1', key: 'indiegogo_en_racoon', type: 'crowdfunding', status: 'permanent', icon: '/img/badges/indiegogo_en_racoon.svg' }),
- f.create('Badge', { id: 'b2', key: 'indiegogo_en_rabbit', type: 'crowdfunding', status: 'permanent', icon: '/img/badges/indiegogo_en_rabbit.svg' }),
- f.create('Badge', { id: 'b3', key: 'indiegogo_en_wolf', type: 'crowdfunding', status: 'permanent', icon: '/img/badges/indiegogo_en_wolf.svg' }),
- f.create('Badge', { id: 'b4', key: 'indiegogo_en_bear', type: 'crowdfunding', status: 'permanent', icon: '/img/badges/indiegogo_en_bear.svg' }),
- f.create('Badge', { id: 'b5', key: 'indiegogo_en_turtle', type: 'crowdfunding', status: 'permanent', icon: '/img/badges/indiegogo_en_turtle.svg' }),
- f.create('Badge', { id: 'b6', key: 'indiegogo_en_rhino', type: 'crowdfunding', status: 'permanent', icon: '/img/badges/indiegogo_en_rhino.svg' })
+ f.create('Badge', {
+ id: 'b1',
+ key: 'indiegogo_en_racoon',
+ type: 'crowdfunding',
+ status: 'permanent',
+ icon: '/img/badges/indiegogo_en_racoon.svg',
+ }),
+ f.create('Badge', {
+ id: 'b2',
+ key: 'indiegogo_en_rabbit',
+ type: 'crowdfunding',
+ status: 'permanent',
+ icon: '/img/badges/indiegogo_en_rabbit.svg',
+ }),
+ f.create('Badge', {
+ id: 'b3',
+ key: 'indiegogo_en_wolf',
+ type: 'crowdfunding',
+ status: 'permanent',
+ icon: '/img/badges/indiegogo_en_wolf.svg',
+ }),
+ f.create('Badge', {
+ id: 'b4',
+ key: 'indiegogo_en_bear',
+ type: 'crowdfunding',
+ status: 'permanent',
+ icon: '/img/badges/indiegogo_en_bear.svg',
+ }),
+ f.create('Badge', {
+ id: 'b5',
+ key: 'indiegogo_en_turtle',
+ type: 'crowdfunding',
+ status: 'permanent',
+ icon: '/img/badges/indiegogo_en_turtle.svg',
+ }),
+ f.create('Badge', {
+ id: 'b6',
+ key: 'indiegogo_en_rhino',
+ type: 'crowdfunding',
+ status: 'permanent',
+ icon: '/img/badges/indiegogo_en_rhino.svg',
+ }),
])
await Promise.all([
- f.create('User', { id: 'u1', name: 'Peter Lustig', role: 'admin', email: 'admin@example.org' }),
- f.create('User', { id: 'u2', name: 'Bob der Baumeister', role: 'moderator', email: 'moderator@example.org' }),
- f.create('User', { id: 'u3', name: 'Jenny Rostock', role: 'user', email: 'user@example.org' }),
- f.create('User', { id: 'u4', name: 'Tick', role: 'user', email: 'tick@example.org' }),
- f.create('User', { id: 'u5', name: 'Trick', role: 'user', email: 'trick@example.org' }),
- f.create('User', { id: 'u6', name: 'Track', role: 'user', email: 'track@example.org' }),
- f.create('User', { id: 'u7', name: 'Dagobert', role: 'user', email: 'dagobert@example.org' })
+ f.create('User', {
+ id: 'u1',
+ name: 'Peter Lustig',
+ role: 'admin',
+ email: 'admin@example.org',
+ }),
+ f.create('User', {
+ id: 'u2',
+ name: 'Bob der Baumeister',
+ role: 'moderator',
+ email: 'moderator@example.org',
+ }),
+ f.create('User', {
+ id: 'u3',
+ name: 'Jenny Rostock',
+ role: 'user',
+ email: 'user@example.org',
+ }),
+ f.create('User', { id: 'u4', name: 'Tick', role: 'user', email: 'tick@example.org' }),
+ f.create('User', { id: 'u5', name: 'Trick', role: 'user', email: 'trick@example.org' }),
+ f.create('User', { id: 'u6', name: 'Track', role: 'user', email: 'track@example.org' }),
+ f.create('User', { id: 'u7', name: 'Dagobert', role: 'user', email: 'dagobert@example.org' }),
])
- const [ asAdmin, asModerator, asUser, asTick, asTrick, asTrack ] = await Promise.all([
- Factory().authenticateAs({ email: 'admin@example.org', password: '1234' }),
+ const [asAdmin, asModerator, asUser, asTick, asTrick, asTrack] = await Promise.all([
+ Factory().authenticateAs({ email: 'admin@example.org', password: '1234' }),
Factory().authenticateAs({ email: 'moderator@example.org', password: '1234' }),
- Factory().authenticateAs({ email: 'user@example.org', password: '1234' }),
- Factory().authenticateAs({ email: 'tick@example.org', password: '1234' }),
- Factory().authenticateAs({ email: 'trick@example.org', password: '1234' }),
- Factory().authenticateAs({ email: 'track@example.org', password: '1234' })
+ Factory().authenticateAs({ email: 'user@example.org', password: '1234' }),
+ Factory().authenticateAs({ email: 'tick@example.org', password: '1234' }),
+ Factory().authenticateAs({ email: 'trick@example.org', password: '1234' }),
+ Factory().authenticateAs({ email: 'track@example.org', password: '1234' }),
])
await Promise.all([
- f.relate('User', 'Badges', { from: 'b6', to: 'u1' }),
- f.relate('User', 'Badges', { from: 'b5', to: 'u2' }),
- f.relate('User', 'Badges', { from: 'b4', to: 'u3' }),
- f.relate('User', 'Badges', { from: 'b3', to: 'u4' }),
- f.relate('User', 'Badges', { from: 'b2', to: 'u5' }),
- f.relate('User', 'Badges', { from: 'b1', to: 'u6' }),
- f.relate('User', 'Friends', { from: 'u1', to: 'u2' }),
- f.relate('User', 'Friends', { from: 'u1', to: 'u3' }),
- f.relate('User', 'Friends', { from: 'u2', to: 'u3' }),
+ f.relate('User', 'Badges', { from: 'b6', to: 'u1' }),
+ f.relate('User', 'Badges', { from: 'b5', to: 'u2' }),
+ f.relate('User', 'Badges', { from: 'b4', to: 'u3' }),
+ f.relate('User', 'Badges', { from: 'b3', to: 'u4' }),
+ f.relate('User', 'Badges', { from: 'b2', to: 'u5' }),
+ f.relate('User', 'Badges', { from: 'b1', to: 'u6' }),
+ f.relate('User', 'Friends', { from: 'u1', to: 'u2' }),
+ f.relate('User', 'Friends', { from: 'u1', to: 'u3' }),
+ f.relate('User', 'Friends', { from: 'u2', to: 'u3' }),
f.relate('User', 'Blacklisted', { from: 'u7', to: 'u4' }),
f.relate('User', 'Blacklisted', { from: 'u7', to: 'u5' }),
- f.relate('User', 'Blacklisted', { from: 'u7', to: 'u6' })
+ f.relate('User', 'Blacklisted', { from: 'u7', to: 'u6' }),
])
await Promise.all([
- asAdmin
- .follow({ id: 'u3', type: 'User' }),
- asModerator
- .follow({ id: 'u4', type: 'User' }),
- asUser
- .follow({ id: 'u4', type: 'User' }),
- asTick
- .follow({ id: 'u6', type: 'User' }),
- asTrick
- .follow({ id: 'u4', type: 'User' }),
- asTrack
- .follow({ id: 'u3', type: 'User' })
+ asAdmin.follow({ id: 'u3', type: 'User' }),
+ asModerator.follow({ id: 'u4', type: 'User' }),
+ asUser.follow({ id: 'u4', type: 'User' }),
+ asTick.follow({ id: 'u6', type: 'User' }),
+ asTrick.follow({ id: 'u4', type: 'User' }),
+ asTrack.follow({ id: 'u3', type: 'User' }),
])
await Promise.all([
- f.create('Category', { id: 'cat1', name: 'Just For Fun', slug: 'justforfun', icon: 'smile' }),
- f.create('Category', { id: 'cat2', name: 'Happyness & Values', slug: 'happyness-values', icon: 'heart-o' }),
- f.create('Category', { id: 'cat3', name: 'Health & Wellbeing', slug: 'health-wellbeing', icon: 'medkit' }),
- f.create('Category', { id: 'cat4', name: 'Environment & Nature', slug: 'environment-nature', icon: 'tree' }),
- f.create('Category', { id: 'cat5', name: 'Animal Protection', slug: 'animalprotection', icon: 'paw' }),
- f.create('Category', { id: 'cat6', name: 'Humanrights Justice', slug: 'humanrights-justice', icon: 'balance-scale' }),
- f.create('Category', { id: 'cat7', name: 'Education & Sciences', slug: 'education-sciences', icon: 'graduation-cap' }),
- f.create('Category', { id: 'cat8', name: 'Cooperation & Development', slug: 'cooperation-development', icon: 'users' }),
- f.create('Category', { id: 'cat9', name: 'Democracy & Politics', slug: 'democracy-politics', icon: 'university' }),
- f.create('Category', { id: 'cat10', name: 'Economy & Finances', slug: 'economy-finances', icon: 'money' }),
- f.create('Category', { id: 'cat11', name: 'Energy & Technology', slug: 'energy-technology', icon: 'flash' }),
- f.create('Category', { id: 'cat12', name: 'IT, Internet & Data Privacy', slug: 'it-internet-dataprivacy', icon: 'mouse-pointer' }),
- f.create('Category', { id: 'cat13', name: 'Art, Curlure & Sport', slug: 'art-culture-sport', icon: 'paint-brush' }),
- f.create('Category', { id: 'cat14', name: 'Freedom of Speech', slug: 'freedomofspeech', icon: 'bullhorn' }),
- f.create('Category', { id: 'cat15', name: 'Consumption & Sustainability', slug: 'consumption-sustainability', icon: 'shopping-cart' }),
- f.create('Category', { id: 'cat16', name: 'Global Peace & Nonviolence', slug: 'globalpeace-nonviolence', icon: 'angellist' })
+ f.create('Category', { id: 'cat1', name: 'Just For Fun', slug: 'justforfun', icon: 'smile' }),
+ f.create('Category', {
+ id: 'cat2',
+ name: 'Happyness & Values',
+ slug: 'happyness-values',
+ icon: 'heart-o',
+ }),
+ f.create('Category', {
+ id: 'cat3',
+ name: 'Health & Wellbeing',
+ slug: 'health-wellbeing',
+ icon: 'medkit',
+ }),
+ f.create('Category', {
+ id: 'cat4',
+ name: 'Environment & Nature',
+ slug: 'environment-nature',
+ icon: 'tree',
+ }),
+ f.create('Category', {
+ id: 'cat5',
+ name: 'Animal Protection',
+ slug: 'animalprotection',
+ icon: 'paw',
+ }),
+ f.create('Category', {
+ id: 'cat6',
+ name: 'Humanrights Justice',
+ slug: 'humanrights-justice',
+ icon: 'balance-scale',
+ }),
+ f.create('Category', {
+ id: 'cat7',
+ name: 'Education & Sciences',
+ slug: 'education-sciences',
+ icon: 'graduation-cap',
+ }),
+ f.create('Category', {
+ id: 'cat8',
+ name: 'Cooperation & Development',
+ slug: 'cooperation-development',
+ icon: 'users',
+ }),
+ f.create('Category', {
+ id: 'cat9',
+ name: 'Democracy & Politics',
+ slug: 'democracy-politics',
+ icon: 'university',
+ }),
+ f.create('Category', {
+ id: 'cat10',
+ name: 'Economy & Finances',
+ slug: 'economy-finances',
+ icon: 'money',
+ }),
+ f.create('Category', {
+ id: 'cat11',
+ name: 'Energy & Technology',
+ slug: 'energy-technology',
+ icon: 'flash',
+ }),
+ f.create('Category', {
+ id: 'cat12',
+ name: 'IT, Internet & Data Privacy',
+ slug: 'it-internet-dataprivacy',
+ icon: 'mouse-pointer',
+ }),
+ f.create('Category', {
+ id: 'cat13',
+ name: 'Art, Curlure & Sport',
+ slug: 'art-culture-sport',
+ icon: 'paint-brush',
+ }),
+ f.create('Category', {
+ id: 'cat14',
+ name: 'Freedom of Speech',
+ slug: 'freedomofspeech',
+ icon: 'bullhorn',
+ }),
+ f.create('Category', {
+ id: 'cat15',
+ name: 'Consumption & Sustainability',
+ slug: 'consumption-sustainability',
+ icon: 'shopping-cart',
+ }),
+ f.create('Category', {
+ id: 'cat16',
+ name: 'Global Peace & Nonviolence',
+ slug: 'globalpeace-nonviolence',
+ icon: 'angellist',
+ }),
])
await Promise.all([
f.create('Tag', { id: 't1', name: 'Umwelt' }),
f.create('Tag', { id: 't2', name: 'Naturschutz' }),
f.create('Tag', { id: 't3', name: 'Demokratie' }),
- f.create('Tag', { id: 't4', name: 'Freiheit' })
+ f.create('Tag', { id: 't4', name: 'Freiheit' }),
])
const mention1 = 'Hey @jenny-rostock , what\'s up?'
- const mention2 = 'Hey @jenny-rostock , here is another notification for you!'
+ const mention2 =
+ 'Hey @jenny-rostock , here is another notification for you!'
await Promise.all([
- asAdmin.create('Post', { id: 'p0' }),
+ asAdmin.create('Post', { id: 'p0' }),
asModerator.create('Post', { id: 'p1' }),
- asUser.create('Post', { id: 'p2' }),
- asTick.create('Post', { id: 'p3' }),
- asTrick.create('Post', { id: 'p4' }),
- asTrack.create('Post', { id: 'p5' }),
- asAdmin.create('Post', { id: 'p6' }),
+ asUser.create('Post', { id: 'p2' }),
+ asTick.create('Post', { id: 'p3' }),
+ asTrick.create('Post', { id: 'p4' }),
+ asTrack.create('Post', { id: 'p5' }),
+ asAdmin.create('Post', { id: 'p6' }),
asModerator.create('Post', { id: 'p7', content: `${mention1} ${faker.lorem.paragraph()}` }),
- asUser.create('Post', { id: 'p8' }),
- asTick.create('Post', { id: 'p9' }),
- asTrick.create('Post', { id: 'p10' }),
- asTrack.create('Post', { id: 'p11' }),
- asAdmin.create('Post', { id: 'p12', content: `${mention2} ${faker.lorem.paragraph()}` }),
+ asUser.create('Post', { id: 'p8' }),
+ asTick.create('Post', { id: 'p9' }),
+ asTrick.create('Post', { id: 'p10' }),
+ asTrack.create('Post', { id: 'p11' }),
+ asAdmin.create('Post', { id: 'p12', content: `${mention2} ${faker.lorem.paragraph()}` }),
asModerator.create('Post', { id: 'p13' }),
- asUser.create('Post', { id: 'p14' }),
- asTick.create('Post', { id: 'p15' })
+ asUser.create('Post', { id: 'p14' }),
+ asTick.create('Post', { id: 'p15' }),
])
await Promise.all([
- f.relate('Post', 'Categories', { from: 'p0', to: 'cat16' }),
- f.relate('Post', 'Categories', { from: 'p1', to: 'cat1' }),
- f.relate('Post', 'Categories', { from: 'p2', to: 'cat2' }),
- f.relate('Post', 'Categories', { from: 'p3', to: 'cat3' }),
- f.relate('Post', 'Categories', { from: 'p4', to: 'cat4' }),
- f.relate('Post', 'Categories', { from: 'p5', to: 'cat5' }),
- f.relate('Post', 'Categories', { from: 'p6', to: 'cat6' }),
- f.relate('Post', 'Categories', { from: 'p7', to: 'cat7' }),
- f.relate('Post', 'Categories', { from: 'p8', to: 'cat8' }),
- f.relate('Post', 'Categories', { from: 'p9', to: 'cat9' }),
+ f.relate('Post', 'Categories', { from: 'p0', to: 'cat16' }),
+ f.relate('Post', 'Categories', { from: 'p1', to: 'cat1' }),
+ f.relate('Post', 'Categories', { from: 'p2', to: 'cat2' }),
+ f.relate('Post', 'Categories', { from: 'p3', to: 'cat3' }),
+ f.relate('Post', 'Categories', { from: 'p4', to: 'cat4' }),
+ f.relate('Post', 'Categories', { from: 'p5', to: 'cat5' }),
+ f.relate('Post', 'Categories', { from: 'p6', to: 'cat6' }),
+ f.relate('Post', 'Categories', { from: 'p7', to: 'cat7' }),
+ f.relate('Post', 'Categories', { from: 'p8', to: 'cat8' }),
+ f.relate('Post', 'Categories', { from: 'p9', to: 'cat9' }),
f.relate('Post', 'Categories', { from: 'p10', to: 'cat10' }),
f.relate('Post', 'Categories', { from: 'p11', to: 'cat11' }),
f.relate('Post', 'Categories', { from: 'p12', to: 'cat12' }),
@@ -129,63 +250,45 @@ import Factory from './factories'
f.relate('Post', 'Categories', { from: 'p14', to: 'cat14' }),
f.relate('Post', 'Categories', { from: 'p15', to: 'cat15' }),
- f.relate('Post', 'Tags', { from: 'p0', to: 't4' }),
- f.relate('Post', 'Tags', { from: 'p1', to: 't1' }),
- f.relate('Post', 'Tags', { from: 'p2', to: 't2' }),
- f.relate('Post', 'Tags', { from: 'p3', to: 't3' }),
- f.relate('Post', 'Tags', { from: 'p4', to: 't4' }),
- f.relate('Post', 'Tags', { from: 'p5', to: 't1' }),
- f.relate('Post', 'Tags', { from: 'p6', to: 't2' }),
- f.relate('Post', 'Tags', { from: 'p7', to: 't3' }),
- f.relate('Post', 'Tags', { from: 'p8', to: 't4' }),
- f.relate('Post', 'Tags', { from: 'p9', to: 't1' }),
+ f.relate('Post', 'Tags', { from: 'p0', to: 't4' }),
+ f.relate('Post', 'Tags', { from: 'p1', to: 't1' }),
+ f.relate('Post', 'Tags', { from: 'p2', to: 't2' }),
+ f.relate('Post', 'Tags', { from: 'p3', to: 't3' }),
+ f.relate('Post', 'Tags', { from: 'p4', to: 't4' }),
+ f.relate('Post', 'Tags', { from: 'p5', to: 't1' }),
+ f.relate('Post', 'Tags', { from: 'p6', to: 't2' }),
+ f.relate('Post', 'Tags', { from: 'p7', to: 't3' }),
+ f.relate('Post', 'Tags', { from: 'p8', to: 't4' }),
+ f.relate('Post', 'Tags', { from: 'p9', to: 't1' }),
f.relate('Post', 'Tags', { from: 'p10', to: 't2' }),
f.relate('Post', 'Tags', { from: 'p11', to: 't3' }),
f.relate('Post', 'Tags', { from: 'p12', to: 't4' }),
f.relate('Post', 'Tags', { from: 'p13', to: 't1' }),
f.relate('Post', 'Tags', { from: 'p14', to: 't2' }),
- f.relate('Post', 'Tags', { from: 'p15', to: 't3' })
+ f.relate('Post', 'Tags', { from: 'p15', to: 't3' }),
])
await Promise.all([
- asAdmin
- .shout({ id: 'p2', type: 'Post' }),
- asAdmin
- .shout({ id: 'p6', type: 'Post' }),
- asModerator
- .shout({ id: 'p0', type: 'Post' }),
- asModerator
- .shout({ id: 'p6', type: 'Post' }),
- asUser
- .shout({ id: 'p6', type: 'Post' }),
- asUser
- .shout({ id: 'p7', type: 'Post' }),
- asTick
- .shout({ id: 'p8', type: 'Post' }),
- asTick
- .shout({ id: 'p9', type: 'Post' }),
- asTrack
- .shout({ id: 'p10', type: 'Post' })
+ asAdmin.shout({ id: 'p2', type: 'Post' }),
+ asAdmin.shout({ id: 'p6', type: 'Post' }),
+ asModerator.shout({ id: 'p0', type: 'Post' }),
+ asModerator.shout({ id: 'p6', type: 'Post' }),
+ asUser.shout({ id: 'p6', type: 'Post' }),
+ asUser.shout({ id: 'p7', type: 'Post' }),
+ asTick.shout({ id: 'p8', type: 'Post' }),
+ asTick.shout({ id: 'p9', type: 'Post' }),
+ asTrack.shout({ id: 'p10', type: 'Post' }),
])
await Promise.all([
- asAdmin
- .shout({ id: 'p2', type: 'Post' }),
- asAdmin
- .shout({ id: 'p6', type: 'Post' }),
- asModerator
- .shout({ id: 'p0', type: 'Post' }),
- asModerator
- .shout({ id: 'p6', type: 'Post' }),
- asUser
- .shout({ id: 'p6', type: 'Post' }),
- asUser
- .shout({ id: 'p7', type: 'Post' }),
- asTick
- .shout({ id: 'p8', type: 'Post' }),
- asTick
- .shout({ id: 'p9', type: 'Post' }),
- asTrack
- .shout({ id: 'p10', type: 'Post' })
+ asAdmin.shout({ id: 'p2', type: 'Post' }),
+ asAdmin.shout({ id: 'p6', type: 'Post' }),
+ asModerator.shout({ id: 'p0', type: 'Post' }),
+ asModerator.shout({ id: 'p6', type: 'Post' }),
+ asUser.shout({ id: 'p6', type: 'Post' }),
+ asUser.shout({ id: 'p7', type: 'Post' }),
+ asTick.shout({ id: 'p8', type: 'Post' }),
+ asTick.shout({ id: 'p9', type: 'Post' }),
+ asTrack.shout({ id: 'p10', type: 'Post' }),
])
await Promise.all([
@@ -200,33 +303,49 @@ import Factory from './factories'
asTrick.create('Comment', { id: 'c9', postId: 'p15' }),
asTrack.create('Comment', { id: 'c10', postId: 'p15' }),
asUser.create('Comment', { id: 'c11', postId: 'p15' }),
- asUser.create('Comment', { id: 'c12', postId: 'p15' })
+ asUser.create('Comment', { id: 'c12', postId: 'p15' }),
])
const disableMutation = 'mutation($id: ID!) { disable(id: $id) }'
await Promise.all([
asModerator.mutate(disableMutation, { id: 'p11' }),
- asModerator.mutate(disableMutation, { id: 'c5' })
+ asModerator.mutate(disableMutation, { id: 'c5' }),
])
await Promise.all([
- asTick.create('Report', { description: 'I don\'t like this comment', id: 'c1' }),
- asTrick.create('Report', { description: 'I don\'t like this post', id: 'p1' }),
- asTrack.create('Report', { description: 'I don\'t like this user', id: 'u1' })
+ asTick.create('Report', { description: "I don't like this comment", id: 'c1' }),
+ asTrick.create('Report', { description: "I don't like this post", id: 'p1' }),
+ asTrack.create('Report', { description: "I don't like this user", id: 'u1' }),
])
await Promise.all([
- f.create('Organization', { id: 'o1', name: 'Democracy Deutschland', description: 'Description for democracy-deutschland.' }),
- f.create('Organization', { id: 'o2', name: 'Human-Connection', description: 'Description for human-connection.' }),
- f.create('Organization', { id: 'o3', name: 'Pro Veg', description: 'Description for pro-veg.' }),
- f.create('Organization', { id: 'o4', name: 'Greenpeace', description: 'Description for greenpeace.' })
+ f.create('Organization', {
+ id: 'o1',
+ name: 'Democracy Deutschland',
+ description: 'Description for democracy-deutschland.',
+ }),
+ f.create('Organization', {
+ id: 'o2',
+ name: 'Human-Connection',
+ description: 'Description for human-connection.',
+ }),
+ f.create('Organization', {
+ id: 'o3',
+ name: 'Pro Veg',
+ description: 'Description for pro-veg.',
+ }),
+ f.create('Organization', {
+ id: 'o4',
+ name: 'Greenpeace',
+ description: 'Description for greenpeace.',
+ }),
])
await Promise.all([
f.relate('Organization', 'CreatedBy', { from: 'u1', to: 'o1' }),
f.relate('Organization', 'CreatedBy', { from: 'u1', to: 'o2' }),
- f.relate('Organization', 'OwnedBy', { from: 'u2', to: 'o2' }),
- f.relate('Organization', 'OwnedBy', { from: 'u2', to: 'o3' })
+ f.relate('Organization', 'OwnedBy', { from: 'u2', to: 'o2' }),
+ f.relate('Organization', 'OwnedBy', { from: 'u2', to: 'o3' }),
])
/* eslint-disable-next-line no-console */
console.log('Seeded Data...')
diff --git a/backend/src/seed/seed-helpers.js b/backend/src/seed/seed-helpers.js
index 23bde40ae..399d06670 100644
--- a/backend/src/seed/seed-helpers.js
+++ b/backend/src/seed/seed-helpers.js
@@ -19,7 +19,7 @@ const unsplashTopics = [
'face',
'people',
'portrait',
- 'amazing'
+ 'amazing',
]
let unsplashTopicsTmp = []
@@ -30,7 +30,7 @@ const ngoLogos = [
'https://dcassetcdn.com/design_img/10133/25833/25833_303600_10133_image.jpg',
'https://cdn.tutsplus.com/vector/uploads/legacy/articles/08bad_ngologos/20.jpg',
'https://cdn.tutsplus.com/vector/uploads/legacy/articles/08bad_ngologos/33.jpg',
- null
+ null,
]
const difficulties = ['easy', 'medium', 'hard']
@@ -38,8 +38,7 @@ const difficulties = ['easy', 'medium', 'hard']
export default {
randomItem: (items, filter) => {
let ids = filter
- ? Object.keys(items)
- .filter(id => {
+ ? Object.keys(items).filter(id => {
return filter(items[id])
})
: _.keys(items)
@@ -61,7 +60,7 @@ export default {
}
return res
},
- random: (items) => {
+ random: items => {
return _.shuffle(items).pop()
},
randomDifficulty: () => {
@@ -78,7 +77,9 @@ export default {
if (unsplashTopicsTmp.length < 2) {
unsplashTopicsTmp = _.shuffle(unsplashTopics)
}
- return 'https://source.unsplash.com/daily?' + unsplashTopicsTmp.pop() + ',' + unsplashTopicsTmp.pop()
+ return (
+ 'https://source.unsplash.com/daily?' + unsplashTopicsTmp.pop() + ',' + unsplashTopicsTmp.pop()
+ )
},
randomCategories: (seederstore, allowEmpty = false) => {
let count = Math.round(Math.random() * 3)
@@ -101,8 +102,8 @@ export default {
zipCode: faker.address.zipCode(),
street: faker.address.streetAddress(),
country: faker.address.countryCode(),
- lat: 54.032726 - (Math.random() * 10),
- lng: 6.558838 + (Math.random() * 10)
+ lat: 54.032726 - Math.random() * 10,
+ lng: 6.558838 + Math.random() * 10,
})
}
return addresses
@@ -129,5 +130,5 @@ export default {
code += chars.substr(n, 1)
}
return code
- }
+ },
}
diff --git a/backend/src/server.js b/backend/src/server.js
index fe0d4ee1d..59261302f 100644
--- a/backend/src/server.js
+++ b/backend/src/server.js
@@ -28,17 +28,17 @@ let schema = makeAugmentedSchema({
resolvers,
config: {
query: {
- exclude: ['Notfication', 'Statistics', 'LoggedInUser']
+ exclude: ['Notfication', 'Statistics', 'LoggedInUser'],
},
mutation: {
- exclude: ['Notfication', 'Statistics', 'LoggedInUser']
+ exclude: ['Notfication', 'Statistics', 'LoggedInUser'],
},
- debug: debug
- }
+ debug: debug,
+ },
})
schema = applyScalars(applyDirectives(schema))
-const createServer = (options) => {
+const createServer = options => {
const defaults = {
context: async ({ request }) => {
const authorizationHeader = request.headers.authorization || ''
@@ -48,15 +48,15 @@ const createServer = (options) => {
user,
req: request,
cypherParams: {
- currentUserId: user ? user.id : null
- }
+ currentUserId: user ? user.id : null,
+ },
}
},
schema: schema,
debug: debug,
tracing: debug,
middlewares: middleware(schema),
- mocks: (process.env.MOCK === 'true') ? mocks : false
+ mocks: process.env.MOCK === 'true' ? mocks : false,
}
const server = new GraphQLServer(Object.assign({}, defaults, options))
From 5202763dd8837ab2b5e7a03c92f1f0d26ed69b31 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Thu, 23 May 2019 19:40:39 +0200
Subject: [PATCH 23/28] frontend lint fixes
---
webapp/components/Badges.vue | 8 +-
webapp/components/Category/index.spec.js | 4 +-
webapp/components/Category/index.vue | 4 +-
webapp/components/Comment.spec.js | 14 +--
webapp/components/Comment.vue | 14 +--
webapp/components/ContentMenu.vue | 32 +++----
webapp/components/ContributionForm/index.vue | 32 +++----
webapp/components/CountTo.vue | 10 +-
webapp/components/Dropdown.vue | 24 ++---
webapp/components/Editor/index.vue | 51 +++++------
webapp/components/Editor/nodes/Mention.js | 8 +-
.../components/Editor/plugins/eventHandler.js | 21 ++---
webapp/components/Editor/spec.js | 8 +-
webapp/components/Empty.vue | 14 +--
webapp/components/FollowButton.vue | 16 ++--
webapp/components/Image/index.vue | 8 +-
webapp/components/Image/spec.js | 8 +-
webapp/components/LoadMore.vue | 4 +-
webapp/components/LocaleSwitch.vue | 14 +--
webapp/components/Modal.spec.js | 32 +++----
webapp/components/Modal.vue | 12 +--
webapp/components/Modal/DeleteModal.spec.js | 16 ++--
webapp/components/Modal/DeleteModal.vue | 14 +--
webapp/components/Modal/DisableModal.spec.js | 22 ++---
webapp/components/Modal/DisableModal.vue | 12 +--
webapp/components/Modal/ReportModal.spec.js | 18 ++--
webapp/components/Modal/ReportModal.vue | 14 +--
webapp/components/Password/Change.spec.js | 29 ++----
webapp/components/Password/Change.vue | 38 +++-----
webapp/components/Password/Strength.vue | 12 +--
webapp/components/PostCard/index.vue | 12 +--
webapp/components/PostCard/spec.js | 13 ++-
webapp/components/RelativeDateTime/index.vue | 12 +--
webapp/components/RelativeDateTime/spec.js | 9 +-
webapp/components/Ribbon/index.spec.js | 4 +-
webapp/components/Ribbon/index.vue | 9 +-
webapp/components/SearchInput.spec.js | 11 +--
webapp/components/SearchInput.vue | 24 +++--
webapp/components/ShoutButton.vue | 18 ++--
webapp/components/Tag/index.vue | 4 +-
webapp/components/Tag/spec.js | 4 +-
webapp/components/User/index.vue | 10 +-
webapp/components/User/spec.js | 16 ++--
.../components/comments/CommentForm/index.vue | 20 ++--
.../components/comments/CommentForm/spec.js | 19 ++--
.../comments/CommentList/CommentList.spec.js | 14 ++-
.../components/comments/CommentList/index.vue | 18 ++--
.../notifications/Notification/index.vue | 10 +-
.../notifications/Notification/spec.js | 11 +--
.../notifications/NotificationList/index.vue | 10 +-
.../notifications/NotificationList/spec.js | 38 +++-----
.../notifications/NotificationMenu/index.vue | 16 ++--
.../notifications/NotificationMenu/spec.js | 23 +++--
webapp/graphql/PostMutations.js | 2 +-
webapp/layouts/blank.vue | 2 +-
webapp/layouts/default.vue | 27 +++---
webapp/locales/index.js | 18 ++--
webapp/mixins/persistentLinks.js | 4 +-
webapp/mixins/seo.js | 8 +-
webapp/nuxt.config.js | 81 +++++++----------
webapp/pages/admin.vue | 12 +--
webapp/pages/admin/categories.vue | 14 +--
webapp/pages/admin/index.vue | 12 +--
webapp/pages/admin/notifications.vue | 4 +-
webapp/pages/admin/organizations.vue | 4 +-
webapp/pages/admin/pages.vue | 4 +-
webapp/pages/admin/settings.vue | 4 +-
webapp/pages/admin/tags.vue | 16 ++--
webapp/pages/admin/users.vue | 4 +-
webapp/pages/index.vue | 22 ++---
webapp/pages/login.vue | 18 ++--
webapp/pages/logout.vue | 2 +-
webapp/pages/moderation.vue | 8 +-
webapp/pages/moderation/index.vue | 41 +++++----
webapp/pages/post/_id.vue | 16 ++--
webapp/pages/post/_id/_slug/index.vue | 20 ++--
webapp/pages/post/_id/_slug/more-info.vue | 14 +--
webapp/pages/post/_id/_slug/take-action.vue | 4 +-
webapp/pages/post/create.vue | 5 +-
webapp/pages/post/edit/_id.vue | 14 +--
webapp/pages/profile/_id.vue | 4 +-
webapp/pages/profile/_id/_slug.vue | 33 +++----
webapp/pages/settings.vue | 12 +--
webapp/pages/settings/data-download.vue | 4 +-
webapp/pages/settings/delete-account.vue | 4 +-
webapp/pages/settings/index.spec.js | 18 ++--
webapp/pages/settings/index.vue | 45 ++++-----
webapp/pages/settings/invites.vue | 4 +-
webapp/pages/settings/languages.vue | 4 +-
webapp/pages/settings/my-organizations.vue | 4 +-
webapp/pages/settings/my-social-media.spec.js | 30 +++---
webapp/pages/settings/my-social-media.vue | 44 ++++-----
webapp/pages/settings/security.vue | 5 +-
webapp/plugins/apollo-config.js | 4 +-
webapp/plugins/i18n.js | 13 +--
webapp/plugins/izi-toast.js | 2 +-
webapp/plugins/keep-alive.js | 2 +-
webapp/plugins/v-tooltip.js | 6 +-
webapp/plugins/vue-directives.js | 4 +-
webapp/plugins/vue-filters.js | 17 +---
webapp/server/index.js | 2 +-
webapp/store/auth.js | 27 ++----
webapp/store/auth.test.js | 91 ++++++++-----------
webapp/store/index.js | 2 +-
webapp/store/modal.js | 6 +-
webapp/store/notifications.js | 17 ++--
webapp/store/search.js | 12 +--
107 files changed, 738 insertions(+), 896 deletions(-)
diff --git a/webapp/components/Badges.vue b/webapp/components/Badges.vue
index b28412abe..ff8a2bd35 100644
--- a/webapp/components/Badges.vue
+++ b/webapp/components/Badges.vue
@@ -23,14 +23,14 @@
import HcImage from './Image'
export default {
components: {
- HcImage
+ HcImage,
},
props: {
badges: {
type: Array,
- default: () => []
- }
- }
+ default: () => [],
+ },
+ },
}
diff --git a/webapp/components/Category/index.spec.js b/webapp/components/Category/index.spec.js
index 149f96189..7ce0b7243 100644
--- a/webapp/components/Category/index.spec.js
+++ b/webapp/components/Category/index.spec.js
@@ -14,8 +14,8 @@ describe('Category', () => {
localVue,
propsData: {
icon,
- name
- }
+ name,
+ },
})
}
diff --git a/webapp/components/Category/index.vue b/webapp/components/Category/index.vue
index 028d8c4a4..31c1aa97b 100644
--- a/webapp/components/Category/index.vue
+++ b/webapp/components/Category/index.vue
@@ -13,7 +13,7 @@ export default {
name: 'HcCategory',
props: {
icon: { type: String, required: true },
- name: { type: String, default: '' }
- }
+ name: { type: String, default: '' },
+ },
}
diff --git a/webapp/components/Comment.spec.js b/webapp/components/Comment.spec.js
index 83a738956..6b5339ec2 100644
--- a/webapp/components/Comment.spec.js
+++ b/webapp/components/Comment.spec.js
@@ -1,6 +1,5 @@
-import { config, shallowMount, mount, createLocalVue } from '@vue/test-utils'
+import { config, shallowMount, createLocalVue } from '@vue/test-utils'
import Comment from './Comment.vue'
-import Vue from 'vue'
import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide'
@@ -12,8 +11,6 @@ localVue.use(Styleguide)
config.stubs['no-ssr'] = ' '
describe('Comment.vue', () => {
- let wrapper
- let Wrapper
let propsData
let mocks
let getters
@@ -21,20 +18,20 @@ describe('Comment.vue', () => {
beforeEach(() => {
propsData = {}
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
getters = {
'auth/user': () => {
return {}
},
- 'auth/isModerator': () => false
+ 'auth/isModerator': () => false,
}
})
describe('shallowMount', () => {
const Wrapper = () => {
const store = new Vuex.Store({
- getters
+ getters,
})
return shallowMount(Comment, { store, propsData, mocks, localVue })
}
@@ -43,7 +40,7 @@ describe('Comment.vue', () => {
beforeEach(() => {
propsData.comment = {
id: '2',
- contentExcerpt: 'Hello I am a comment content'
+ contentExcerpt: 'Hello I am a comment content',
}
})
@@ -68,7 +65,6 @@ describe('Comment.vue', () => {
})
it('translates a placeholder', () => {
- const wrapper = Wrapper()
const calls = mocks.$t.mock.calls
const expected = [['comment.content.unavailable-placeholder']]
expect(calls).toEqual(expect.arrayContaining(expected))
diff --git a/webapp/components/Comment.vue b/webapp/components/Comment.vue
index 13edc9c0d..dcad2a2ac 100644
--- a/webapp/components/Comment.vue
+++ b/webapp/components/Comment.vue
@@ -43,20 +43,20 @@ import ContentMenu from '~/components/ContentMenu'
export default {
components: {
HcUser,
- ContentMenu
+ ContentMenu,
},
props: {
comment: {
type: Object,
default() {
return {}
- }
- }
+ },
+ },
},
computed: {
...mapGetters({
user: 'auth/user',
- isModerator: 'auth/isModerator'
+ isModerator: 'auth/isModerator',
}),
displaysComment() {
return !this.unavailable || this.isModerator
@@ -64,12 +64,12 @@ export default {
author() {
if (this.deleted) return {}
return this.comment.author || {}
- }
+ },
},
methods: {
isAuthor(id) {
return this.user.id === id
- }
- }
+ },
+ },
}
diff --git a/webapp/components/ContentMenu.vue b/webapp/components/ContentMenu.vue
index 29473d6b2..a2e73b8af 100644
--- a/webapp/components/ContentMenu.vue
+++ b/webapp/components/ContentMenu.vue
@@ -48,7 +48,7 @@ import Dropdown from '~/components/Dropdown'
export default {
components: {
- Dropdown
+ Dropdown,
},
props: {
placement: { type: String, default: 'top-end' },
@@ -59,8 +59,8 @@ export default {
required: true,
validator: value => {
return value.match(/(contribution|comment|organization|user)/)
- }
- }
+ },
+ },
},
computed: {
routes() {
@@ -72,17 +72,17 @@ export default {
path: this.$router.resolve({
name: 'post-edit-id',
params: {
- id: this.resource.id
- }
+ id: this.resource.id,
+ },
}).href,
- icon: 'edit'
+ icon: 'edit',
})
routes.push({
name: this.$t(`post.delete.title`),
callback: () => {
this.openModal('delete')
},
- icon: 'trash'
+ icon: 'trash',
})
}
if (this.isOwner && this.resourceType === 'comment') {
@@ -92,7 +92,7 @@ export default {
/* eslint-disable-next-line no-console */
console.log('EDIT COMMENT')
},
- icon: 'edit'
+ icon: 'edit',
})
}
@@ -102,7 +102,7 @@ export default {
callback: () => {
this.openModal('report')
},
- icon: 'flag'
+ icon: 'flag',
})
}
@@ -112,7 +112,7 @@ export default {
callback: () => {
this.openModal('disable')
},
- icon: 'eye-slash'
+ icon: 'eye-slash',
})
}
@@ -120,14 +120,14 @@ export default {
routes.push({
name: this.$t(`settings.name`),
path: '/settings',
- icon: 'edit'
+ icon: 'edit',
})
}
return routes
},
isModerator() {
return this.$store.getters['auth/isModerator']
- }
+ },
},
methods: {
openItem(route, toggleMenu) {
@@ -143,11 +143,11 @@ export default {
name: dialog,
data: {
type: this.resourceType,
- resource: this.resource
- }
+ resource: this.resource,
+ },
})
- }
- }
+ },
+ },
}
diff --git a/webapp/components/ContributionForm/index.vue b/webapp/components/ContributionForm/index.vue
index 6dc74f104..48ad99315 100644
--- a/webapp/components/ContributionForm/index.vue
+++ b/webapp/components/ContributionForm/index.vue
@@ -53,26 +53,26 @@ import HcEditor from '~/components/Editor'
export default {
components: {
- HcEditor
+ HcEditor,
},
props: {
- contribution: { type: Object, default: () => {} }
+ contribution: { type: Object, default: () => {} },
},
data() {
return {
form: {
title: '',
- content: ''
+ content: '',
},
formSchema: {
title: { required: true, min: 3, max: 64 },
- content: { required: true, min: 3 }
+ content: { required: true, min: 3 },
},
id: null,
loading: false,
disabled: false,
slug: null,
- users: []
+ users: [],
}
},
watch: {
@@ -86,8 +86,8 @@ export default {
this.slug = contribution.slug
this.form.content = contribution.content
this.form.title = contribution.title
- }
- }
+ },
+ },
},
methods: {
submit() {
@@ -96,14 +96,12 @@ export default {
this.$apollo
.mutate({
- mutation: this.id
- ? postMutations.UpdatePost
- : postMutations.CreatePost,
+ mutation: this.id ? postMutations.UpdatePost : postMutations.CreatePost,
variables: {
id: this.id,
title: this.form.title,
- content: this.form.content
- }
+ content: this.form.content,
+ },
})
.then(res => {
this.loading = false
@@ -114,7 +112,7 @@ export default {
this.$router.push({
name: 'post-id-slug',
- params: { id: result.id, slug: result.slug }
+ params: { id: result.id, slug: result.slug },
})
})
.catch(err => {
@@ -126,7 +124,7 @@ export default {
updateEditorContent(value) {
// this.form.content = value
this.$refs.contributionForm.update('content', value)
- }
+ },
},
apollo: {
User: {
@@ -140,9 +138,9 @@ export default {
},
result(result) {
this.users = result.data.User
- }
- }
- }
+ },
+ },
+ },
}
diff --git a/webapp/components/CountTo.vue b/webapp/components/CountTo.vue
index 3083040f5..89f3d5cf8 100644
--- a/webapp/components/CountTo.vue
+++ b/webapp/components/CountTo.vue
@@ -19,19 +19,19 @@
import CountTo from 'vue-count-to'
export default {
components: {
- CountTo
+ CountTo,
},
props: {
startVal: { type: Number, default: 0 },
endVal: { type: Number, required: true },
duration: { type: Number, default: 3000 },
autoplay: { type: Boolean, default: true },
- separator: { type: String, default: '.' }
+ separator: { type: String, default: '.' },
},
data() {
return {
lastEndVal: null,
- isReady: false
+ isReady: false,
}
},
watch: {
@@ -39,12 +39,12 @@ export default {
if (this.isReady && this.startVal === 0 && !this.lastEndVal) {
this.lastEndVal = this.endVal
}
- }
+ },
},
mounted() {
setTimeout(() => {
this.isReady = true
}, 500)
- }
+ },
}
diff --git a/webapp/components/Dropdown.vue b/webapp/components/Dropdown.vue
index 1cfe84c2b..89b05aced 100644
--- a/webapp/components/Dropdown.vue
+++ b/webapp/components/Dropdown.vue
@@ -30,8 +30,6 @@
diff --git a/webapp/components/Editor/index.vue b/webapp/components/Editor/index.vue
index 5b542b3ce..ac1391a42 100644
--- a/webapp/components/Editor/index.vue
+++ b/webapp/components/Editor/index.vue
@@ -166,12 +166,7 @@ import linkify from 'linkify-it'
import stringHash from 'string-hash'
import Fuse from 'fuse.js'
import tippy from 'tippy.js'
-import {
- Editor,
- EditorContent,
- EditorFloatingMenu,
- EditorMenuBubble
-} from 'tiptap'
+import { Editor, EditorContent, EditorFloatingMenu, EditorMenuBubble } from 'tiptap'
import EventHandler from './plugins/eventHandler.js'
import {
Heading,
@@ -187,7 +182,7 @@ import {
Strike,
Underline,
Link,
- History
+ History,
} from 'tiptap-extensions'
import Mention from './nodes/Mention.js'
@@ -197,12 +192,12 @@ export default {
components: {
EditorContent,
EditorFloatingMenu,
- EditorMenuBubble
+ EditorMenuBubble,
},
props: {
users: { type: Array, default: () => [] },
value: { type: String, default: '' },
- doc: { type: Object, default: () => {} }
+ doc: { type: Object, default: () => {} },
},
data() {
return {
@@ -227,7 +222,7 @@ export default {
new ListItem(),
new Placeholder({
emptyNodeClass: 'is-empty',
- emptyNodeText: this.$t('editor.placeholder')
+ emptyNodeText: this.$t('editor.placeholder'),
}),
new History(),
new Mention({
@@ -290,16 +285,16 @@ export default {
}
const fuse = new Fuse(items, {
threshold: 0.2,
- keys: ['slug']
+ keys: ['slug'],
})
return fuse.search(query)
- }
- })
+ },
+ }),
],
onUpdate: e => {
clearTimeout(throttleInputEvent)
throttleInputEvent = setTimeout(() => this.onUpdate(e), 300)
- }
+ },
}),
linkUrl: null,
linkMenuIsActive: false,
@@ -308,7 +303,7 @@ export default {
filteredUsers: [],
navigatedUserIndex: 0,
insertMention: () => {},
- observer: null
+ observer: null,
}
},
computed: {
@@ -317,7 +312,7 @@ export default {
},
showSuggestions() {
return this.query || this.hasResults
- }
+ },
},
watch: {
value: {
@@ -329,8 +324,8 @@ export default {
}
this.lastValueHash = contentHash
this.editor.setContent(content)
- }
- }
+ },
+ },
},
beforeDestroy() {
this.editor.destroy()
@@ -340,14 +335,12 @@ export default {
// if it's the first item, navigate to the last one
upHandler() {
this.navigatedUserIndex =
- (this.navigatedUserIndex + this.filteredUsers.length - 1) %
- this.filteredUsers.length
+ (this.navigatedUserIndex + this.filteredUsers.length - 1) % this.filteredUsers.length
},
// navigate to the next item
// if it's the last item, navigate to the first one
downHandler() {
- this.navigatedUserIndex =
- (this.navigatedUserIndex + 1) % this.filteredUsers.length
+ this.navigatedUserIndex = (this.navigatedUserIndex + 1) % this.filteredUsers.length
},
enterHandler() {
const user = this.filteredUsers[this.navigatedUserIndex]
@@ -363,8 +356,8 @@ export default {
attrs: {
// TODO: use router here
url: `/profile/${user.id}`,
- label: user.slug
- }
+ label: user.slug,
+ },
})
this.editor.focus()
},
@@ -384,7 +377,7 @@ export default {
duration: [400, 200],
showOnInit: true,
arrow: true,
- arrowType: 'round'
+ arrowType: 'round',
})
// we have to update tippy whenever the DOM is updated
if (MutationObserver) {
@@ -394,7 +387,7 @@ export default {
this.observer.observe(this.$refs.suggestions, {
childList: true,
subtree: true,
- characterData: true
+ characterData: true,
})
}
},
@@ -440,7 +433,7 @@ export default {
if (links) {
// add valid link
command({
- href: links.pop().url
+ href: links.pop().url,
})
this.hideLinkMenu()
this.editor.focus()
@@ -451,8 +444,8 @@ export default {
},
clear() {
this.editor.clearContent(true)
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Editor/nodes/Mention.js b/webapp/components/Editor/nodes/Mention.js
index 134fdc64b..dc34a05ff 100644
--- a/webapp/components/Editor/nodes/Mention.js
+++ b/webapp/components/Editor/nodes/Mention.js
@@ -1,5 +1,3 @@
-import { Node } from 'tiptap'
-import { replaceText } from 'tiptap-commands'
import { Mention as TipTapMention } from 'tiptap-extensions'
export default class Mention extends TipTapMention {
@@ -8,7 +6,7 @@ export default class Mention extends TipTapMention {
patchedSchema.attrs = {
url: {},
- label: {}
+ label: {},
}
patchedSchema.toDOM = node => {
return [
@@ -16,9 +14,9 @@ export default class Mention extends TipTapMention {
{
class: this.options.mentionClass,
href: node.attrs.url,
- target: '_blank'
+ target: '_blank',
},
- `${this.options.matcher.char}${node.attrs.label}`
+ `${this.options.matcher.char}${node.attrs.label}`,
]
}
patchedSchema.parseDOM = [
diff --git a/webapp/components/Editor/plugins/eventHandler.js b/webapp/components/Editor/plugins/eventHandler.js
index 6086421b8..c390a066d 100644
--- a/webapp/components/Editor/plugins/eventHandler.js
+++ b/webapp/components/Editor/plugins/eventHandler.js
@@ -18,10 +18,7 @@ export default class EventHandler extends Extension {
// remove all tags with "space only"
.replace(/<[a-z-]+>[\s]+<\/[a-z-]+>/gim, '')
// remove all iframes
- .replace(
- /(]*)(>)[^>]*\/*>/gim,
- ''
- )
+ .replace(/(]*)(>)[^>]*\/*>/gim, '')
.replace(/[\n]{3,}/gim, '\n\n')
.replace(/(\r\n|\n\r|\r|\n)/g, ' $1')
@@ -29,22 +26,16 @@ export default class EventHandler extends Extension {
// limit linebreaks to max 2 (equivalent to html "br" linebreak)
.replace(/( \s*){2,}/gim, ' ')
// remove additional linebreaks after p tags
- .replace(
- /<\/(p|div|th|tr)>\s*( \s*)+\s*<(p|div|th|tr)>/gim,
- ''
- )
+ .replace(/<\/(p|div|th|tr)>\s*( \s*)+\s*<(p|div|th|tr)>/gim, '
')
// remove additional linebreaks inside p tags
- .replace(
- /<[a-z-]+>(<[a-z-]+>)*\s*( \s*)+\s*(<\/[a-z-]+>)*<\/[a-z-]+>/gim,
- ''
- )
+ .replace(/<[a-z-]+>(<[a-z-]+>)*\s*( \s*)+\s*(<\/[a-z-]+>)*<\/[a-z-]+>/gim, '')
// remove additional linebreaks when first child inside p tags
.replace(/
(\s* \s*)+/gim, '
')
// remove additional linebreaks when last child inside p tags
.replace(/(\s* \s*)+<\/p>/gim, '
')
// console.log('#### transformPastedHTML', html)
return html
- }
+ },
// transformPasted(slice) {
// // console.log('#### transformPasted', slice.content)
// let content = []
@@ -76,8 +67,8 @@ export default class EventHandler extends Extension {
// return slice
// // return newSlice
// }
- }
- })
+ },
+ }),
]
}
}
diff --git a/webapp/components/Editor/spec.js b/webapp/components/Editor/spec.js
index 3e1784ed7..249192b57 100644
--- a/webapp/components/Editor/spec.js
+++ b/webapp/components/Editor/spec.js
@@ -14,7 +14,7 @@ describe('Editor.vue', () => {
beforeEach(() => {
propsData = {}
mocks = {
- $t: () => {}
+ $t: () => {},
}
})
@@ -25,7 +25,7 @@ describe('Editor.vue', () => {
propsData,
localVue,
sync: false,
- stubs: { transition: false }
+ stubs: { transition: false },
}))
}
@@ -40,9 +40,7 @@ describe('Editor.vue', () => {
it.skip('renders', () => {
wrapper = Wrapper()
- expect(wrapper.find('.ProseMirror').text()).toContain(
- 'I am a piece of text'
- )
+ expect(wrapper.find('.ProseMirror').text()).toContain('I am a piece of text')
})
})
})
diff --git a/webapp/components/Empty.vue b/webapp/components/Empty.vue
index 082d18f83..25deb9fd3 100644
--- a/webapp/components/Empty.vue
+++ b/webapp/components/Empty.vue
@@ -11,7 +11,7 @@
class="hc-empty-icon"
style="margin-bottom: 5px"
alt="Empty"
- />
+ >
{
return value.match(/(messages|events|alert|tasks|docs|file)/)
- }
+ },
},
/**
* Message that appears under the icon
*/
message: {
type: String,
- default: null
+ default: null,
},
/**
* Vertical spacing
*/
margin: {
type: [String, Object],
- default: 'x-large'
- }
+ default: 'x-large',
+ },
},
computed: {
iconPath() {
return `/img/empty/${this.icon}.svg`
- }
- }
+ },
+ },
}
diff --git a/webapp/components/FollowButton.vue b/webapp/components/FollowButton.vue
index f5c705a8d..7372b8a78 100644
--- a/webapp/components/FollowButton.vue
+++ b/webapp/components/FollowButton.vue
@@ -22,13 +22,13 @@ export default {
props: {
followId: { type: String, default: null },
- isFollowed: { type: Boolean, default: false }
+ isFollowed: { type: Boolean, default: false },
},
data() {
return {
disabled: false,
loading: false,
- hovered: false
+ hovered: false,
}
},
computed: {
@@ -45,13 +45,13 @@ export default {
} else {
return this.$t('followButton.follow')
}
- }
+ },
},
watch: {
isFollowed() {
this.loading = false
this.hovered = false
- }
+ },
},
methods: {
onHover() {
@@ -75,8 +75,8 @@ export default {
}
`,
variables: {
- id: this.followId
- }
+ id: this.followId,
+ },
})
.then(res => {
// this.$emit('optimistic', follow ? res.data.follow : follow)
@@ -85,7 +85,7 @@ export default {
.catch(() => {
this.$emit('optimistic', !follow)
})
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Image/index.vue b/webapp/components/Image/index.vue
index e2f504578..9a4428b2e 100644
--- a/webapp/components/Image/index.vue
+++ b/webapp/components/Image/index.vue
@@ -10,14 +10,14 @@ export default {
props: {
imageProps: {
type: Object,
- required: true
- }
+ required: true,
+ },
},
computed: {
imageSrc() {
const src = this.imageProps.src
return src.startsWith('/') ? src.replace('/', '/api/') : src
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Image/spec.js b/webapp/components/Image/spec.js
index cbc4d34cf..be568964a 100644
--- a/webapp/components/Image/spec.js
+++ b/webapp/components/Image/spec.js
@@ -22,9 +22,7 @@ describe('Image', () => {
})
it('adds a prefix to load the image from the backend', () => {
- expect(Wrapper().attributes('src')).toBe(
- '/api/img/badges/fundraisingbox_de_airship.svg'
- )
+ expect(Wrapper().attributes('src')).toBe('/api/img/badges/fundraisingbox_de_airship.svg')
})
})
@@ -35,9 +33,7 @@ describe('Image', () => {
it('keeps the URL as is', () => {
// e.g. our seeds have absolute image URLs
- expect(Wrapper().attributes('src')).toBe(
- 'http://lorempixel.com/640/480/animals'
- )
+ expect(Wrapper().attributes('src')).toBe('http://lorempixel.com/640/480/animals')
})
})
})
diff --git a/webapp/components/LoadMore.vue b/webapp/components/LoadMore.vue
index dfe00a693..c2a3b6e83 100644
--- a/webapp/components/LoadMore.vue
+++ b/webapp/components/LoadMore.vue
@@ -17,7 +17,7 @@
diff --git a/webapp/components/LocaleSwitch.vue b/webapp/components/LocaleSwitch.vue
index f69d107a9..a00f38109 100644
--- a/webapp/components/LocaleSwitch.vue
+++ b/webapp/components/LocaleSwitch.vue
@@ -49,15 +49,15 @@ import orderBy from 'lodash/orderBy'
export default {
components: {
- Dropdown
+ Dropdown,
},
props: {
placement: { type: String, default: 'bottom-start' },
- offset: { type: [String, Number], default: '16' }
+ offset: { type: [String, Number], default: '16' },
},
data() {
return {
- locales: orderBy(process.env.locales, 'name')
+ locales: orderBy(process.env.locales, 'name'),
}
},
computed: {
@@ -68,11 +68,11 @@ export default {
let routes = this.locales.map(locale => {
return {
name: locale.name,
- path: locale.code
+ path: locale.code,
}
})
return routes
- }
+ },
},
methods: {
changeLanguage(locale, toggleMenu) {
@@ -81,8 +81,8 @@ export default {
},
matcher(locale) {
return locale === this.$i18n.locale()
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Modal.spec.js b/webapp/components/Modal.spec.js
index 1ec032edb..52d13c4a0 100644
--- a/webapp/components/Modal.spec.js
+++ b/webapp/components/Modal.spec.js
@@ -1,8 +1,7 @@
-import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
+import { shallowMount, createLocalVue } from '@vue/test-utils'
import Modal from './Modal.vue'
import DisableModal from './Modal/DisableModal.vue'
import ReportModal from './Modal/ReportModal.vue'
-import Vue from 'vue'
import Vuex from 'vuex'
import { getters, mutations } from '../store/modal'
import Styleguide from '@human-connection/styleguide'
@@ -13,7 +12,6 @@ localVue.use(Vuex)
localVue.use(Styleguide)
describe('Modal.vue', () => {
- let Wrapper
let wrapper
let store
let state
@@ -25,11 +23,11 @@ describe('Modal.vue', () => {
state,
getters: {
'modal/open': getters.open,
- 'modal/data': getters.data
+ 'modal/data': getters.data,
},
mutations: {
- 'modal/SET_OPEN': mutations.SET_OPEN
- }
+ 'modal/SET_OPEN': mutations.SET_OPEN,
+ },
})
return mountMethod(Modal, { store, mocks, localVue })
}
@@ -38,17 +36,17 @@ describe('Modal.vue', () => {
beforeEach(() => {
mocks = {
$filters: {
- truncate: a => a
+ truncate: a => a,
},
$toast: {
success: () => {},
- error: () => {}
+ error: () => {},
},
- $t: () => {}
+ $t: () => {},
}
state = {
open: null,
- data: {}
+ data: {},
}
})
@@ -69,9 +67,9 @@ describe('Modal.vue', () => {
type: 'contribution',
resource: {
id: 'c456',
- title: 'some title'
- }
- }
+ title: 'some title',
+ },
+ },
}
wrapper = Wrapper()
})
@@ -84,7 +82,7 @@ describe('Modal.vue', () => {
expect(wrapper.find(DisableModal).props()).toEqual({
type: 'contribution',
name: 'some title',
- id: 'c456'
+ id: 'c456',
})
})
@@ -99,13 +97,13 @@ describe('Modal.vue', () => {
it('passes author name to disable modal', () => {
state.data = {
type: 'comment',
- resource: { id: 'c456', author: { name: 'Author name' } }
+ resource: { id: 'c456', author: { name: 'Author name' } },
}
wrapper = Wrapper()
expect(wrapper.find(DisableModal).props()).toEqual({
type: 'comment',
name: 'Author name',
- id: 'c456'
+ id: 'c456',
})
})
@@ -115,7 +113,7 @@ describe('Modal.vue', () => {
expect(wrapper.find(DisableModal).props()).toEqual({
type: 'comment',
name: '',
- id: 'c456'
+ id: 'c456',
})
})
})
diff --git a/webapp/components/Modal.vue b/webapp/components/Modal.vue
index 2ea482190..88b89d407 100644
--- a/webapp/components/Modal.vue
+++ b/webapp/components/Modal.vue
@@ -35,17 +35,17 @@ export default {
components: {
DisableModal,
ReportModal,
- DeleteModal
+ DeleteModal,
},
computed: {
...mapGetters({
data: 'modal/data',
- open: 'modal/open'
+ open: 'modal/open',
}),
name() {
if (!this.data || !this.data.resource) return ''
const {
- resource: { name, title, author }
+ resource: { name, title, author },
} = this.data
switch (this.data.type) {
case 'user':
@@ -57,12 +57,12 @@ export default {
default:
return null
}
- }
+ },
},
methods: {
close() {
this.$store.commit('modal/SET_OPEN', {})
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Modal/DeleteModal.spec.js b/webapp/components/Modal/DeleteModal.spec.js
index e52c252ca..bb463be5f 100644
--- a/webapp/components/Modal/DeleteModal.spec.js
+++ b/webapp/components/Modal/DeleteModal.spec.js
@@ -1,6 +1,5 @@
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
import DeleteModal from './DeleteModal.vue'
-import Vue from 'vue'
import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide'
import VueRouter from 'vue-router'
@@ -15,27 +14,26 @@ localVue.use(VueRouter)
describe('DeleteModal.vue', () => {
let wrapper
- let Wrapper
let propsData
let mocks
beforeEach(() => {
propsData = {
type: 'contribution',
- id: 'c300'
+ id: 'c300',
}
mocks = {
$t: jest.fn(),
$filters: {
- truncate: a => a
+ truncate: a => a,
},
$toast: {
success: () => {},
- error: () => {}
+ error: () => {},
},
$apollo: {
- mutate: jest.fn().mockResolvedValue()
- }
+ mutate: jest.fn().mockResolvedValue(),
+ },
}
})
@@ -59,7 +57,7 @@ describe('DeleteModal.vue', () => {
propsData = {
id: 'p23',
type: 'post',
- name: 'It is a post'
+ name: 'It is a post',
}
})
@@ -87,7 +85,7 @@ describe('DeleteModal.vue', () => {
beforeEach(() => {
propsData = {
type: 'user',
- id: 'u3'
+ id: 'u3',
}
wrapper = Wrapper()
})
diff --git a/webapp/components/Modal/DeleteModal.vue b/webapp/components/Modal/DeleteModal.vue
index 0f9fc0d7b..ccbb5a096 100644
--- a/webapp/components/Modal/DeleteModal.vue
+++ b/webapp/components/Modal/DeleteModal.vue
@@ -48,18 +48,18 @@ import { SweetalertIcon } from 'vue-sweetalert-icons'
export default {
name: 'DeleteModal',
components: {
- SweetalertIcon
+ SweetalertIcon,
},
props: {
name: { type: String, default: '' },
type: { type: String, required: true },
- id: { type: String, required: true }
+ id: { type: String, required: true },
},
data() {
return {
isOpen: true,
success: false,
- loading: false
+ loading: false,
}
},
computed: {
@@ -69,7 +69,7 @@ export default {
message() {
const name = this.$filters.truncate(this.name, 30)
return this.$t(`post.delete.message`, { name })
- }
+ },
},
methods: {
async cancel() {
@@ -89,7 +89,7 @@ export default {
}
}
`,
- variables: { id: this.id }
+ variables: { id: this.id },
})
this.success = true
this.$toast.success(this.$t('post.delete.success'))
@@ -113,8 +113,8 @@ export default {
} finally {
this.loading = false
}
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Modal/DisableModal.spec.js b/webapp/components/Modal/DisableModal.spec.js
index e4debdc70..2d98fce52 100644
--- a/webapp/components/Modal/DisableModal.spec.js
+++ b/webapp/components/Modal/DisableModal.spec.js
@@ -1,6 +1,5 @@
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
import DisableModal from './DisableModal.vue'
-import Vue from 'vue'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
@@ -8,7 +7,6 @@ const localVue = createLocalVue()
localVue.use(Styleguide)
describe('DisableModal.vue', () => {
- let store
let mocks
let propsData
let wrapper
@@ -17,20 +15,20 @@ describe('DisableModal.vue', () => {
propsData = {
type: 'contribution',
name: 'blah',
- id: 'c42'
+ id: 'c42',
}
mocks = {
$filters: {
- truncate: a => a
+ truncate: a => a,
},
$toast: {
success: () => {},
- error: () => {}
+ error: () => {},
},
$t: jest.fn(),
$apollo: {
- mutate: jest.fn().mockResolvedValue()
- }
+ mutate: jest.fn().mockResolvedValue(),
+ },
}
})
@@ -44,7 +42,7 @@ describe('DisableModal.vue', () => {
propsData = {
type: 'user',
id: 'u2',
- name: 'Bob Ross'
+ name: 'Bob Ross',
}
})
@@ -61,16 +59,14 @@ describe('DisableModal.vue', () => {
propsData = {
type: 'contribution',
id: 'c3',
- name: 'This is some post title.'
+ name: 'This is some post title.',
}
})
it('mentions contribution title', () => {
Wrapper()
const calls = mocks.$t.mock.calls
- const expected = [
- ['disable.contribution.message', { name: 'This is some post title.' }]
- ]
+ const expected = [['disable.contribution.message', { name: 'This is some post title.' }]]
expect(calls).toEqual(expect.arrayContaining(expected))
})
})
@@ -86,7 +82,7 @@ describe('DisableModal.vue', () => {
beforeEach(() => {
propsData = {
type: 'user',
- id: 'u4711'
+ id: 'u4711',
}
})
diff --git a/webapp/components/Modal/DisableModal.vue b/webapp/components/Modal/DisableModal.vue
index 4ab0293cd..3a30cbce3 100644
--- a/webapp/components/Modal/DisableModal.vue
+++ b/webapp/components/Modal/DisableModal.vue
@@ -34,13 +34,13 @@ export default {
props: {
name: { type: String, default: '' },
type: { type: String, required: true },
- id: { type: String, required: true }
+ id: { type: String, required: true },
},
data() {
return {
isOpen: true,
success: false,
- loading: false
+ loading: false,
}
},
computed: {
@@ -50,7 +50,7 @@ export default {
message() {
const name = this.$filters.truncate(this.name, 30)
return this.$t(`disable.${this.type}.message`, { name })
- }
+ },
},
methods: {
cancel() {
@@ -67,7 +67,7 @@ export default {
disable(id: $id)
}
`,
- variables: { id: this.id }
+ variables: { id: this.id },
})
this.$toast.success(this.$t('disable.success'))
this.isOpen = false
@@ -77,7 +77,7 @@ export default {
} catch (err) {
this.$toast.error(err.message)
}
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Modal/ReportModal.spec.js b/webapp/components/Modal/ReportModal.spec.js
index 865348512..c08788c3b 100644
--- a/webapp/components/Modal/ReportModal.spec.js
+++ b/webapp/components/Modal/ReportModal.spec.js
@@ -1,6 +1,5 @@
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
import ReportModal from './ReportModal.vue'
-import Vue from 'vue'
import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide'
@@ -11,27 +10,26 @@ localVue.use(Styleguide)
describe('ReportModal.vue', () => {
let wrapper
- let Wrapper
let propsData
let mocks
beforeEach(() => {
propsData = {
type: 'contribution',
- id: 'c43'
+ id: 'c43',
}
mocks = {
$t: jest.fn(),
$filters: {
- truncate: a => a
+ truncate: a => a,
},
$toast: {
success: () => {},
- error: () => {}
+ error: () => {},
},
$apollo: {
- mutate: jest.fn().mockResolvedValue()
- }
+ mutate: jest.fn().mockResolvedValue(),
+ },
}
})
@@ -55,7 +53,7 @@ describe('ReportModal.vue', () => {
propsData = {
type: 'user',
id: 'u4',
- name: 'Bob Ross'
+ name: 'Bob Ross',
}
})
@@ -72,7 +70,7 @@ describe('ReportModal.vue', () => {
propsData = {
id: 'p23',
type: 'post',
- name: 'It is a post'
+ name: 'It is a post',
}
})
@@ -100,7 +98,7 @@ describe('ReportModal.vue', () => {
beforeEach(() => {
propsData = {
type: 'user',
- id: 'u4711'
+ id: 'u4711',
}
wrapper = Wrapper()
})
diff --git a/webapp/components/Modal/ReportModal.vue b/webapp/components/Modal/ReportModal.vue
index 846fe5420..078707700 100644
--- a/webapp/components/Modal/ReportModal.vue
+++ b/webapp/components/Modal/ReportModal.vue
@@ -48,18 +48,18 @@ import { SweetalertIcon } from 'vue-sweetalert-icons'
export default {
name: 'ReportModal',
components: {
- SweetalertIcon
+ SweetalertIcon,
},
props: {
name: { type: String, default: '' },
type: { type: String, required: true },
- id: { type: String, required: true }
+ id: { type: String, required: true },
},
data() {
return {
isOpen: true,
success: false,
- loading: false
+ loading: false,
}
},
computed: {
@@ -69,7 +69,7 @@ export default {
message() {
const name = this.$filters.truncate(this.name, 30)
return this.$t(`report.${this.type}.message`, { name })
- }
+ },
},
methods: {
async cancel() {
@@ -89,7 +89,7 @@ export default {
}
}
`,
- variables: { id: this.id }
+ variables: { id: this.id },
})
this.success = true
this.$toast.success(this.$t('report.success'))
@@ -106,8 +106,8 @@ export default {
} finally {
this.loading = false
}
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Password/Change.spec.js b/webapp/components/Password/Change.spec.js
index 77b7ee5b3..cffe86466 100644
--- a/webapp/components/Password/Change.spec.js
+++ b/webapp/components/Password/Change.spec.js
@@ -1,6 +1,5 @@
import { mount, createLocalVue } from '@vue/test-utils'
import ChangePassword from './Change.vue'
-import Vue from 'vue'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
@@ -9,25 +8,24 @@ localVue.use(Styleguide)
describe('ChangePassword.vue', () => {
let mocks
- let wrapper
beforeEach(() => {
mocks = {
validate: jest.fn(),
$toast: {
error: jest.fn(),
- success: jest.fn()
+ success: jest.fn(),
},
$t: jest.fn(),
$store: {
- commit: jest.fn()
+ commit: jest.fn(),
},
$apollo: {
mutate: jest
.fn()
.mockRejectedValue({ message: 'Ouch!' })
- .mockResolvedValueOnce({ data: { changePassword: 'NEWTOKEN' } })
- }
+ .mockResolvedValueOnce({ data: { changePassword: 'NEWTOKEN' } }),
+ },
}
})
@@ -63,9 +61,7 @@ describe('ChangePassword.vue', () => {
it.skip('displays a warning', () => {
const calls = mocks.validate.mock.calls
- const expected = [
- ['change-password.validations.old-and-new-password-match']
- ]
+ const expected = [['change-password.validations.old-and-new-password-match']]
expect(calls).toEqual(expect.arrayContaining(expected))
})
})
@@ -112,9 +108,9 @@ describe('ChangePassword.vue', () => {
variables: {
oldPassword: 'supersecret',
newPassword: 'superdupersecret',
- confirmPassword: 'superdupersecret'
- }
- })
+ confirmPassword: 'superdupersecret',
+ },
+ }),
)
})
@@ -124,16 +120,11 @@ describe('ChangePassword.vue', () => {
})
it('calls auth/SET_TOKEN with response', () => {
- expect(mocks.$store.commit).toHaveBeenCalledWith(
- 'auth/SET_TOKEN',
- 'NEWTOKEN'
- )
+ expect(mocks.$store.commit).toHaveBeenCalledWith('auth/SET_TOKEN', 'NEWTOKEN')
})
it('displays success message', () => {
- expect(mocks.$t).toHaveBeenCalledWith(
- 'settings.security.change-password.success'
- )
+ expect(mocks.$t).toHaveBeenCalledWith('settings.security.change-password.success')
expect(mocks.$toast.success).toHaveBeenCalled()
})
})
diff --git a/webapp/components/Password/Change.vue b/webapp/components/Password/Change.vue
index 4998bbfb4..dd6626019 100644
--- a/webapp/components/Password/Change.vue
+++ b/webapp/components/Password/Change.vue
@@ -46,29 +46,25 @@ import PasswordStrength from './Strength'
export default {
name: 'ChangePassword',
components: {
- PasswordStrength
+ PasswordStrength,
},
data() {
return {
formData: {
oldPassword: '',
newPassword: '',
- confirmPassword: ''
+ confirmPassword: '',
},
formSchema: {
oldPassword: {
type: 'string',
required: true,
- message: this.$t(
- 'settings.security.change-password.message-old-password-required'
- )
+ message: this.$t('settings.security.change-password.message-old-password-required'),
},
newPassword: {
type: 'string',
required: true,
- message: this.$t(
- 'settings.security.change-password.message-new-password-required'
- )
+ message: this.$t('settings.security.change-password.message-new-password-required'),
},
confirmPassword: [
{ validator: this.matchPassword },
@@ -76,13 +72,13 @@ export default {
type: 'string',
required: true,
message: this.$t(
- 'settings.security.change-password.message-new-password-confirm-required'
- )
- }
- ]
+ 'settings.security.change-password.message-new-password-confirm-required',
+ ),
+ },
+ ],
},
loading: false,
- disabled: true
+ disabled: true,
}
},
methods: {
@@ -104,13 +100,11 @@ export default {
try {
const { data } = await this.$apollo.mutate({ mutation, variables })
this.$store.commit('auth/SET_TOKEN', data.changePassword)
- this.$toast.success(
- this.$t('settings.security.change-password.success')
- )
+ this.$toast.success(this.$t('settings.security.change-password.success'))
this.formData = {
oldPassword: '',
newPassword: '',
- confirmPassword: ''
+ confirmPassword: '',
}
} catch (err) {
this.$toast.error(err.message)
@@ -122,15 +116,11 @@ export default {
var errors = []
if (this.formData.newPassword !== value) {
errors.push(
- new Error(
- this.$t(
- 'settings.security.change-password.message-new-password-missmatch'
- )
- )
+ new Error(this.$t('settings.security.change-password.message-new-password-missmatch')),
)
}
callback(errors)
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Password/Strength.vue b/webapp/components/Password/Strength.vue
index 778cfb0d4..c6b8a09ab 100644
--- a/webapp/components/Password/Strength.vue
+++ b/webapp/components/Password/Strength.vue
@@ -28,14 +28,14 @@ export default {
props: {
password: {
type: String,
- required: true
- }
+ required: true,
+ },
},
data() {
return {
strength: null,
isSecure: false,
- pass: this.password || null
+ pass: this.password || null,
}
},
watch: {
@@ -50,11 +50,11 @@ export default {
this.isSecure = Boolean(strength >= 3)
this.$emit('change', {
strength,
- isSecure: this.isSecure
+ isSecure: this.isSecure,
})
}
- }
- }
+ },
+ },
}
diff --git a/webapp/components/PostCard/index.vue b/webapp/components/PostCard/index.vue
index cde334bfd..d3ede45eb 100644
--- a/webapp/components/PostCard/index.vue
+++ b/webapp/components/PostCard/index.vue
@@ -89,17 +89,17 @@ export default {
HcUser,
HcCategory,
HcRibbon,
- ContentMenu
+ ContentMenu,
},
props: {
post: {
type: Object,
- required: true
- }
+ required: true,
+ },
},
computed: {
...mapGetters({
- user: 'auth/user'
+ user: 'auth/user',
}),
excerpt() {
return this.$filters.removeLinks(this.post.contentExcerpt)
@@ -108,8 +108,8 @@ export default {
const { author } = this.post
if (!author) return false
return this.user.id === this.post.author.id
- }
- }
+ },
+ },
}
diff --git a/webapp/components/PostCard/spec.js b/webapp/components/PostCard/spec.js
index 1914733c0..8f818b26b 100644
--- a/webapp/components/PostCard/spec.js
+++ b/webapp/components/PostCard/spec.js
@@ -14,7 +14,6 @@ config.stubs['no-ssr'] = ' '
config.stubs['v-popover'] = ' '
describe('PostCard', () => {
- let wrapper
let stubs
let mocks
let propsData
@@ -23,35 +22,35 @@ describe('PostCard', () => {
beforeEach(() => {
propsData = {}
stubs = {
- NuxtLink: RouterLinkStub
+ NuxtLink: RouterLinkStub,
}
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
getters = {
'auth/user': () => {
return {}
- }
+ },
}
})
const Wrapper = () => {
const store = new Vuex.Store({
- getters
+ getters,
})
return mount(PostCard, {
stubs,
mocks,
propsData,
store,
- localVue
+ localVue,
})
}
describe('given a post', () => {
beforeEach(() => {
propsData.post = {
- title: "It's a title"
+ title: "It's a title",
}
})
diff --git a/webapp/components/RelativeDateTime/index.vue b/webapp/components/RelativeDateTime/index.vue
index 1f9ca2bda..a6187425f 100644
--- a/webapp/components/RelativeDateTime/index.vue
+++ b/webapp/components/RelativeDateTime/index.vue
@@ -4,14 +4,14 @@
diff --git a/webapp/components/RelativeDateTime/spec.js b/webapp/components/RelativeDateTime/spec.js
index 446a5a8a1..15574f539 100644
--- a/webapp/components/RelativeDateTime/spec.js
+++ b/webapp/components/RelativeDateTime/spec.js
@@ -4,7 +4,6 @@ import RelativeDateTime from './'
const localVue = createLocalVue()
describe('RelativeDateTime', () => {
- let wrapper
let mocks
let locale
let dateTime
@@ -12,8 +11,8 @@ describe('RelativeDateTime', () => {
beforeEach(() => {
mocks = {
$i18n: {
- locale: () => locale
- }
+ locale: () => locale,
+ },
}
})
@@ -22,8 +21,8 @@ describe('RelativeDateTime', () => {
mocks,
localVue,
propsData: {
- dateTime
- }
+ dateTime,
+ },
})
}
diff --git a/webapp/components/Ribbon/index.spec.js b/webapp/components/Ribbon/index.spec.js
index 8c6507e88..b1c519992 100644
--- a/webapp/components/Ribbon/index.spec.js
+++ b/webapp/components/Ribbon/index.spec.js
@@ -10,8 +10,8 @@ describe('Ribbon', () => {
return shallowMount(Ribbon, {
localVue,
propsData: {
- text
- }
+ text,
+ },
})
}
diff --git a/webapp/components/Ribbon/index.vue b/webapp/components/Ribbon/index.vue
index 783bf974f..c92935352 100644
--- a/webapp/components/Ribbon/index.vue
+++ b/webapp/components/Ribbon/index.vue
@@ -10,9 +10,9 @@ export default {
props: {
text: {
type: String,
- default: ''
- }
- }
+ default: '',
+ },
+ },
}
@@ -43,8 +43,7 @@ export default {
bottom: -6px;
border-width: 3px 4px 3px 3px;
border-style: solid;
- border-color: $background-color-secondary transparent transparent
- $background-color-secondary;
+ border-color: $background-color-secondary transparent transparent $background-color-secondary;
}
}
diff --git a/webapp/components/SearchInput.spec.js b/webapp/components/SearchInput.spec.js
index 2f3f31987..bf44b906b 100644
--- a/webapp/components/SearchInput.spec.js
+++ b/webapp/components/SearchInput.spec.js
@@ -10,7 +10,6 @@ localVue.filter('truncate', () => 'truncated string')
localVue.filter('dateTime', () => Date.now)
describe('SearchInput.vue', () => {
- let wrapper
let mocks
let propsData
@@ -21,7 +20,7 @@ describe('SearchInput.vue', () => {
describe('mount', () => {
const Wrapper = () => {
mocks = {
- $t: () => {}
+ $t: () => {},
}
return mount(SearchInput, { mocks, localVue, propsData })
}
@@ -121,7 +120,7 @@ describe('SearchInput.vue', () => {
__typename: 'User',
id: 'u5',
name: 'Trick',
- slug: 'trick'
+ slug: 'trick',
},
commentsCount: 0,
createdAt: '2019-03-13T11:00:20.835Z',
@@ -129,9 +128,9 @@ describe('SearchInput.vue', () => {
label: 'Eos aut illo omnis quis eaque et iure aut.',
shoutedCount: 0,
slug: 'eos-aut-illo-omnis-quis-eaque-et-iure-aut',
- value: 'Eos aut illo omnis quis eaque et iure aut.'
- }
- ]
+ value: 'Eos aut illo omnis quis eaque et iure aut.',
+ },
+ ],
}
wrapper = Wrapper()
select.trigger('input')
diff --git a/webapp/components/SearchInput.vue b/webapp/components/SearchInput.vue
index 7ce174a9a..33c938656 100644
--- a/webapp/components/SearchInput.vue
+++ b/webapp/components/SearchInput.vue
@@ -98,24 +98,24 @@ export default {
props: {
id: {
type: String,
- default: 'nav-search'
+ default: 'nav-search',
},
value: {
type: String,
- default: ''
+ default: '',
},
results: {
type: Array,
- default: () => []
+ default: () => [],
},
delay: {
type: Number,
- default: 300
+ default: 300,
},
pending: {
type: Boolean,
- default: false
- }
+ default: false,
+ },
},
data() {
return {
@@ -123,7 +123,7 @@ export default {
isOpen: false,
lastSearchTerm: '',
unprocessedSearchInput: '',
- searchValue: ''
+ searchValue: '',
}
},
computed: {
@@ -132,10 +132,8 @@ export default {
return !isEmpty(this.lastSearchTerm)
},
emptyText() {
- return this.isActive && !this.pending
- ? this.$t('search.failed')
- : this.$t('search.hint')
- }
+ return this.isActive && !this.pending ? this.$t('search.failed') : this.$t('search.hint')
+ },
},
methods: {
async query(value) {
@@ -201,8 +199,8 @@ export default {
this.unprocessedSearchInput = ''
this.lastSearchTerm = ''
this.searchValue = ''
- }
- }
+ },
+ },
}
diff --git a/webapp/components/ShoutButton.vue b/webapp/components/ShoutButton.vue
index 02d7cb639..4486abf8e 100644
--- a/webapp/components/ShoutButton.vue
+++ b/webapp/components/ShoutButton.vue
@@ -35,13 +35,13 @@ export default {
count: { type: Number, default: 0 },
postId: { type: String, default: null },
isShouted: { type: Boolean, default: false },
- disabled: { type: Boolean, default: false }
+ disabled: { type: Boolean, default: false },
},
data() {
return {
loading: false,
shoutedCount: this.count,
- shouted: false
+ shouted: false,
}
},
watch: {
@@ -49,8 +49,8 @@ export default {
immediate: true,
handler: function(shouted) {
this.shouted = shouted
- }
- }
+ },
+ },
},
methods: {
toggle() {
@@ -60,7 +60,7 @@ export default {
const backup = {
shoutedCount: this.shoutedCount,
- shouted: this.shouted
+ shouted: this.shouted,
}
this.shoutedCount = count
@@ -74,8 +74,8 @@ export default {
}
`,
variables: {
- id: this.postId
- }
+ id: this.postId,
+ },
})
.then(res => {
if (res && res.data) {
@@ -89,8 +89,8 @@ export default {
.finally(() => {
this.loading = false
})
- }
- }
+ },
+ },
}
diff --git a/webapp/components/Tag/index.vue b/webapp/components/Tag/index.vue
index 70e1cf2a2..9337c02a6 100644
--- a/webapp/components/Tag/index.vue
+++ b/webapp/components/Tag/index.vue
@@ -9,7 +9,7 @@
export default {
name: 'HcTag',
props: {
- name: { type: String, required: true }
- }
+ name: { type: String, required: true },
+ },
}
diff --git a/webapp/components/Tag/spec.js b/webapp/components/Tag/spec.js
index fa49d4d95..6a82ce641 100644
--- a/webapp/components/Tag/spec.js
+++ b/webapp/components/Tag/spec.js
@@ -12,8 +12,8 @@ describe('Tag', () => {
return shallowMount(Tag, {
localVue,
propsData: {
- name
- }
+ name,
+ },
})
}
diff --git a/webapp/components/User/index.vue b/webapp/components/User/index.vue
index 105a79f8c..82a08c5e1 100644
--- a/webapp/components/User/index.vue
+++ b/webapp/components/User/index.vue
@@ -151,16 +151,16 @@ export default {
HcRelativeDateTime,
HcFollowButton,
HcBadges,
- Dropdown
+ Dropdown,
},
props: {
user: { type: Object, default: null },
trunc: { type: Number, default: null },
- dateTime: { type: [Date, String], default: null }
+ dateTime: { type: [Date, String], default: null },
},
computed: {
...mapGetters({
- isModerator: 'auth/isModerator'
+ isModerator: 'auth/isModerator',
}),
itsMe() {
return this.user.slug === this.$store.getters['auth/user'].slug
@@ -177,8 +177,8 @@ export default {
userName() {
const { name } = this.user || {}
return name || this.$t('profile.userAnonym')
- }
- }
+ },
+ },
}
diff --git a/webapp/components/User/spec.js b/webapp/components/User/spec.js
index 4bc286d20..56bdc10f1 100644
--- a/webapp/components/User/spec.js
+++ b/webapp/components/User/spec.js
@@ -1,6 +1,5 @@
-import { config, mount, createLocalVue, RouterLinkStub } from '@vue/test-utils'
+import { mount, createLocalVue, RouterLinkStub } from '@vue/test-utils'
import User from './index'
-import Vue from 'vue'
import Vuex from 'vuex'
import VTooltip from 'v-tooltip'
@@ -16,35 +15,32 @@ localVue.use(Styleguide)
localVue.filter('truncate', filter)
describe('User', () => {
- let wrapper
- let Wrapper
let propsData
let mocks
let stubs
let getters
- let user
beforeEach(() => {
propsData = {}
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
stubs = {
- NuxtLink: RouterLinkStub
+ NuxtLink: RouterLinkStub,
}
getters = {
'auth/user': () => {
return {}
},
- 'auth/isModerator': () => false
+ 'auth/isModerator': () => false,
}
})
describe('mount', () => {
const Wrapper = () => {
const store = new Vuex.Store({
- getters
+ getters,
})
return mount(User, { store, propsData, mocks, stubs, localVue })
}
@@ -59,7 +55,7 @@ describe('User', () => {
beforeEach(() => {
propsData.user = {
name: 'Tilda Swinton',
- slug: 'tilda-swinton'
+ slug: 'tilda-swinton',
}
})
diff --git a/webapp/components/comments/CommentForm/index.vue b/webapp/components/comments/CommentForm/index.vue
index fedd8a884..05ab2356e 100644
--- a/webapp/components/comments/CommentForm/index.vue
+++ b/webapp/components/comments/CommentForm/index.vue
@@ -48,20 +48,20 @@ import HcEditor from '~/components/Editor'
export default {
components: {
- HcEditor
+ HcEditor,
},
props: {
post: { type: Object, default: () => {} },
- comments: { type: Array, default: () => [] }
+ comments: { type: Array, default: () => [] },
},
data() {
return {
disabled: true,
loading: false,
form: {
- content: ''
+ content: '',
},
- users: []
+ users: [],
}
},
methods: {
@@ -92,8 +92,8 @@ export default {
`,
variables: {
postId: this.post.id,
- content: this.form.content
- }
+ content: this.form.content,
+ },
})
.then(res => {
this.loading = false
@@ -105,7 +105,7 @@ export default {
.catch(err => {
this.$toast.error(err.message)
})
- }
+ },
},
apollo: {
User: {
@@ -119,8 +119,8 @@ export default {
},
result(result) {
this.users = result.data.User
- }
- }
- }
+ },
+ },
+ },
}
diff --git a/webapp/components/comments/CommentForm/spec.js b/webapp/components/comments/CommentForm/spec.js
index 511f76c1d..0259e7101 100644
--- a/webapp/components/comments/CommentForm/spec.js
+++ b/webapp/components/comments/CommentForm/spec.js
@@ -1,6 +1,5 @@
import { config, mount, createLocalVue, createWrapper } from '@vue/test-utils'
import CommentForm from './index.vue'
-import Vue from 'vue'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
@@ -17,24 +16,24 @@ describe('CommentForm.vue', () => {
let cancelMethodSpy
beforeEach(() => {
- ;(mocks = {
+ mocks = {
$t: jest.fn(),
$apollo: {
mutate: jest
.fn()
.mockResolvedValueOnce({
- data: { CreateComment: { contentExcerpt: 'this is a comment' } }
+ data: { CreateComment: { contentExcerpt: 'this is a comment' } },
})
- .mockRejectedValue({ message: 'Ouch!' })
+ .mockRejectedValue({ message: 'Ouch!' }),
},
$toast: {
error: jest.fn(),
- success: jest.fn()
- }
- }),
- (propsData = {
- post: { id: 1 }
- })
+ success: jest.fn(),
+ },
+ }
+ propsData = {
+ post: { id: 1 },
+ }
})
describe('mount', () => {
diff --git a/webapp/components/comments/CommentList/CommentList.spec.js b/webapp/components/comments/CommentList/CommentList.spec.js
index 6a96f3e19..55a75fbb2 100644
--- a/webapp/components/comments/CommentList/CommentList.spec.js
+++ b/webapp/components/comments/CommentList/CommentList.spec.js
@@ -1,9 +1,7 @@
import { config, mount, createLocalVue } from '@vue/test-utils'
import CommentList from '.'
import Empty from '~/components/Empty'
-import Vue from 'vue'
import Vuex from 'vuex'
-import Filters from '~/plugins/vue-filters'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
@@ -24,21 +22,21 @@ describe('CommentList.vue', () => {
let data
propsData = {
- post: { id: 1 }
+ post: { id: 1 },
}
store = new Vuex.Store({
getters: {
'auth/user': () => {
return {}
- }
- }
+ },
+ },
})
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
data = () => {
return {
- comments: []
+ comments: [],
}
}
@@ -50,7 +48,7 @@ describe('CommentList.vue', () => {
beforeEach(() => {
wrapper = Wrapper()
wrapper.setData({
- comments: [{ id: 'c1', contentExcerpt: 'this is a comment' }]
+ comments: [{ id: 'c1', contentExcerpt: 'this is a comment' }],
})
})
diff --git a/webapp/components/comments/CommentList/index.vue b/webapp/components/comments/CommentList/index.vue
index 57b720087..3ea4337ba 100644
--- a/webapp/components/comments/CommentList/index.vue
+++ b/webapp/components/comments/CommentList/index.vue
@@ -38,20 +38,20 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
Comment,
- HcEmpty
+ HcEmpty,
},
props: {
- post: { type: Object, default: () => {} }
+ post: { type: Object, default: () => {} },
},
data() {
return {
- comments: []
+ comments: [],
}
},
watch: {
Post(post) {
this.comments = post[0].comments || []
- }
+ },
},
mounted() {
this.$root.$on('refetchPostComments', comment => {
@@ -61,7 +61,7 @@ export default {
methods: {
refetchPostComments(comment) {
this.$apollo.queries.Post.refetch()
- }
+ },
},
apollo: {
Post: {
@@ -70,11 +70,11 @@ export default {
},
variables() {
return {
- slug: this.post.slug
+ slug: this.post.slug,
}
},
- fetchPolicy: 'cache-and-network'
- }
- }
+ fetchPolicy: 'cache-and-network',
+ },
+ },
}
diff --git a/webapp/components/notifications/Notification/index.vue b/webapp/components/notifications/Notification/index.vue
index cae34a2f1..3e69dc415 100644
--- a/webapp/components/notifications/Notification/index.vue
+++ b/webapp/components/notifications/Notification/index.vue
@@ -44,13 +44,13 @@ import HcUser from '~/components/User'
export default {
name: 'Notification',
components: {
- HcUser
+ HcUser,
},
props: {
notification: {
type: Object,
- required: true
- }
+ required: true,
+ },
},
computed: {
excerpt() {
@@ -58,8 +58,8 @@ export default {
},
post() {
return this.notification.post || {}
- }
- }
+ },
+ },
}
diff --git a/webapp/components/notifications/Notification/spec.js b/webapp/components/notifications/Notification/spec.js
index 8c6c846a4..6a380b9de 100644
--- a/webapp/components/notifications/Notification/spec.js
+++ b/webapp/components/notifications/Notification/spec.js
@@ -11,17 +11,16 @@ localVue.use(Filters)
config.stubs['no-ssr'] = ' '
describe('Notification', () => {
- let wrapper
let stubs
let mocks
let propsData
beforeEach(() => {
propsData = {}
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
stubs = {
- NuxtLink: RouterLinkStub
+ NuxtLink: RouterLinkStub,
}
})
@@ -30,7 +29,7 @@ describe('Notification', () => {
stubs,
mocks,
propsData,
- localVue
+ localVue,
})
}
@@ -38,8 +37,8 @@ describe('Notification', () => {
beforeEach(() => {
propsData.notification = {
post: {
- title: "It's a title"
- }
+ title: "It's a title",
+ },
}
})
diff --git a/webapp/components/notifications/NotificationList/index.vue b/webapp/components/notifications/NotificationList/index.vue
index b8235f853..af1c86732 100644
--- a/webapp/components/notifications/NotificationList/index.vue
+++ b/webapp/components/notifications/NotificationList/index.vue
@@ -15,18 +15,18 @@ import Notification from '../Notification'
export default {
name: 'NotificationList',
components: {
- Notification
+ Notification,
},
props: {
notifications: {
type: Array,
- required: true
- }
+ required: true,
+ },
},
methods: {
markAsRead(notificationId) {
this.$emit('markAsRead', notificationId)
- }
- }
+ },
+ },
}
diff --git a/webapp/components/notifications/NotificationList/spec.js b/webapp/components/notifications/NotificationList/spec.js
index c433abd80..c4841c95a 100644
--- a/webapp/components/notifications/NotificationList/spec.js
+++ b/webapp/components/notifications/NotificationList/spec.js
@@ -1,13 +1,6 @@
-import {
- config,
- shallowMount,
- mount,
- createLocalVue,
- RouterLinkStub
-} from '@vue/test-utils'
+import { config, shallowMount, mount, createLocalVue, RouterLinkStub } from '@vue/test-utils'
import NotificationList from '.'
import Notification from '../Notification'
-import Vue from 'vue'
import Vuex from 'vuex'
import Filters from '~/plugins/vue-filters'
@@ -25,7 +18,6 @@ config.stubs['v-popover'] = ' '
describe('NotificationList.vue', () => {
let wrapper
- let Wrapper
let mocks
let stubs
let store
@@ -36,14 +28,14 @@ describe('NotificationList.vue', () => {
getters: {
'auth/user': () => {
return {}
- }
- }
+ },
+ },
})
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
stubs = {
- NuxtLink: RouterLinkStub
+ NuxtLink: RouterLinkStub,
}
propsData = {
notifications: [
@@ -57,9 +49,9 @@ describe('NotificationList.vue', () => {
author: {
id: 'john-1',
slug: 'john-doe',
- name: 'John Doe'
- }
- }
+ name: 'John Doe',
+ },
+ },
},
{
id: 'notification-42',
@@ -71,11 +63,11 @@ describe('NotificationList.vue', () => {
author: {
id: 'john-1',
slug: 'john-doe',
- name: 'John Doe'
- }
- }
- }
- ]
+ name: 'John Doe',
+ },
+ },
+ },
+ ],
}
})
@@ -85,7 +77,7 @@ describe('NotificationList.vue', () => {
propsData,
mocks,
store,
- localVue
+ localVue,
})
}
@@ -105,7 +97,7 @@ describe('NotificationList.vue', () => {
mocks,
stubs,
store,
- localVue
+ localVue,
})
}
diff --git a/webapp/components/notifications/NotificationMenu/index.vue b/webapp/components/notifications/NotificationMenu/index.vue
index 819858e3b..4bc61dd92 100644
--- a/webapp/components/notifications/NotificationMenu/index.vue
+++ b/webapp/components/notifications/NotificationMenu/index.vue
@@ -66,12 +66,12 @@ export default {
name: 'NotificationMenu',
components: {
NotificationList,
- Dropdown
+ Dropdown,
},
computed: {
totalNotifications() {
return (this.notifications || []).length
- }
+ },
},
methods: {
async markAsRead(notificationId) {
@@ -79,24 +79,24 @@ export default {
try {
await this.$apollo.mutate({
mutation: MARK_AS_READ,
- variables
+ variables,
})
} catch (err) {
throw new Error(err)
}
- }
+ },
},
apollo: {
notifications: {
query: NOTIFICATIONS,
update: data => {
const {
- currentUser: { notifications }
+ currentUser: { notifications },
} = data
return notifications
- }
- }
- }
+ },
+ },
+ },
}
diff --git a/webapp/components/notifications/NotificationMenu/spec.js b/webapp/components/notifications/NotificationMenu/spec.js
index 4c9dd9d43..673a85944 100644
--- a/webapp/components/notifications/NotificationMenu/spec.js
+++ b/webapp/components/notifications/NotificationMenu/spec.js
@@ -14,16 +14,15 @@ config.stubs['dropdown'] = ' '
describe('NotificationMenu.vue', () => {
let wrapper
- let Wrapper
let mocks
let data
beforeEach(() => {
mocks = {
- $t: jest.fn()
+ $t: jest.fn(),
}
data = () => {
return {
- notifications: []
+ notifications: [],
}
}
})
@@ -33,7 +32,7 @@ describe('NotificationMenu.vue', () => {
return shallowMount(NotificationMenu, {
data,
mocks,
- localVue
+ localVue,
})
}
@@ -62,9 +61,9 @@ describe('NotificationMenu.vue', () => {
author: {
id: 'john-1',
slug: 'john-doe',
- name: 'John Doe'
- }
- }
+ name: 'John Doe',
+ },
+ },
},
{
id: 'notification-42',
@@ -76,11 +75,11 @@ describe('NotificationMenu.vue', () => {
author: {
id: 'john-1',
slug: 'john-doe',
- name: 'John Doe'
- }
- }
- }
- ]
+ name: 'John Doe',
+ },
+ },
+ },
+ ],
}
}
})
diff --git a/webapp/graphql/PostMutations.js b/webapp/graphql/PostMutations.js
index d92445744..dbaa4cd78 100644
--- a/webapp/graphql/PostMutations.js
+++ b/webapp/graphql/PostMutations.js
@@ -23,6 +23,6 @@ export default app => {
contentExcerpt
}
}
- `)
+ `),
}
}
diff --git a/webapp/layouts/blank.vue b/webapp/layouts/blank.vue
index 570799a4d..81d25a5ca 100644
--- a/webapp/layouts/blank.vue
+++ b/webapp/layouts/blank.vue
@@ -13,6 +13,6 @@
import seo from '~/mixins/seo'
export default {
- mixins: [seo]
+ mixins: [seo],
}
diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue
index f34b02899..34544ae06 100644
--- a/webapp/layouts/default.vue
+++ b/webapp/layouts/default.vue
@@ -131,13 +131,12 @@ export default {
LocaleSwitch,
SearchInput,
Modal,
- LocaleSwitch,
- NotificationMenu
+ NotificationMenu,
},
mixins: [seo],
data() {
return {
- mobileSearchVisible: false
+ mobileSearchVisible: false,
}
},
computed: {
@@ -147,7 +146,7 @@ export default {
isModerator: 'auth/isModerator',
isAdmin: 'auth/isAdmin',
quickSearchResults: 'search/quickResults',
- quickSearchPending: 'search/quickPending'
+ quickSearchPending: 'search/quickPending',
}),
userName() {
const { name } = this.user || {}
@@ -161,41 +160,41 @@ export default {
{
name: this.$t('profile.name'),
path: `/profile/${this.user.slug}`,
- icon: 'user'
+ icon: 'user',
},
{
name: this.$t('settings.name'),
path: `/settings`,
- icon: 'cogs'
- }
+ icon: 'cogs',
+ },
]
if (this.isModerator) {
routes.push({
name: this.$t('moderation.name'),
path: `/moderation`,
- icon: 'balance-scale'
+ icon: 'balance-scale',
})
}
if (this.isAdmin) {
routes.push({
name: this.$t('admin.name'),
path: `/admin`,
- icon: 'shield'
+ icon: 'shield',
})
}
return routes
- }
+ },
},
methods: {
...mapActions({
quickSearchClear: 'search/quickClear',
- quickSearch: 'search/quickSearch'
+ quickSearch: 'search/quickSearch',
}),
goToPost(item) {
this.$nextTick(() => {
this.$router.push({
name: 'post-id-slug',
- params: { id: item.id, slug: item.slug }
+ params: { id: item.id, slug: item.slug },
})
})
},
@@ -205,8 +204,8 @@ export default {
return this.$route.path === url
}
return this.$route.path.indexOf(url) === 0
- }
- }
+ },
+ },
}
diff --git a/webapp/locales/index.js b/webapp/locales/index.js
index 35a99b317..b4dbedc6e 100644
--- a/webapp/locales/index.js
+++ b/webapp/locales/index.js
@@ -3,48 +3,48 @@ module.exports = [
name: 'English',
code: 'en',
iso: 'en-US',
- enabled: true
+ enabled: true,
},
{
name: 'Deutsch',
code: 'de',
iso: 'de-DE',
- enabled: true
+ enabled: true,
},
{
name: 'Nederlands',
code: 'nl',
iso: 'nl-NL',
- enabled: true
+ enabled: true,
},
{
name: 'Français',
code: 'fr',
iso: 'fr-FR',
- enabled: true
+ enabled: true,
},
{
name: 'Italiano',
code: 'it',
iso: 'it-IT',
- enabled: true
+ enabled: true,
},
{
name: 'Español',
code: 'es',
iso: 'es-ES',
- enabled: true
+ enabled: true,
},
{
name: 'Português',
code: 'pt',
iso: 'pt-PT',
- enabled: true
+ enabled: true,
},
{
name: 'Polski',
code: 'pl',
iso: 'pl-PL',
- enabled: true
- }
+ enabled: true,
+ },
]
diff --git a/webapp/mixins/persistentLinks.js b/webapp/mixins/persistentLinks.js
index 5cecbbdbd..efc4392e2 100644
--- a/webapp/mixins/persistentLinks.js
+++ b/webapp/mixins/persistentLinks.js
@@ -6,7 +6,7 @@ export default function(options = {}) {
params: { id, slug },
redirect,
error,
- app: { apolloProvider }
+ app: { apolloProvider },
} = context
const idOrSlug = id || slug
@@ -27,6 +27,6 @@ export default function(options = {}) {
if (resource) return redirect(`/${path}/${resource.id}/${resource.slug}`)
return error({ statusCode: 404, message })
- }
+ },
}
}
diff --git a/webapp/mixins/seo.js b/webapp/mixins/seo.js
index de641e677..2dd0ecb20 100644
--- a/webapp/mixins/seo.js
+++ b/webapp/mixins/seo.js
@@ -2,11 +2,11 @@ export default {
head() {
return {
htmlAttrs: {
- lang: this.$i18n.locale()
+ lang: this.$i18n.locale(),
},
bodyAttrs: {
- class: `page-name-${this.$route.name}`
- }
+ class: `page-name-${this.$route.name}`,
+ },
}
- }
+ },
}
diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js
index 9d0ae0fc3..a50ac9e2a 100644
--- a/webapp/nuxt.config.js
+++ b/webapp/nuxt.config.js
@@ -6,7 +6,7 @@ const styleguidePath = '../Nitro-Styleguide'
const styleguideStyles = process.env.STYLEGUIDE_DEV
? [
`${styleguidePath}/src/system/styles/main.scss`,
- `${styleguidePath}/src/system/styles/shared.scss`
+ `${styleguidePath}/src/system/styles/shared.scss`,
]
: '@human-connection/styleguide/dist/shared.scss'
@@ -20,24 +20,16 @@ module.exports = {
transition: {
name: 'slide-up',
- mode: 'out-in'
+ mode: 'out-in',
},
env: {
// pages which do NOT require a login
- publicPages: [
- 'login',
- 'logout',
- 'register',
- 'signup',
- 'reset',
- 'reset-token',
- 'pages-slug'
- ],
+ publicPages: ['login', 'logout', 'register', 'signup', 'reset', 'reset-token', 'pages-slug'],
// pages to keep alive
keepAlivePages: ['index'],
// active locales
- locales: require('./locales')
+ locales: require('./locales'),
},
/*
** Headers of the page
@@ -48,9 +40,9 @@ module.exports = {
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
- { hid: 'description', name: 'description', content: pkg.description }
+ { hid: 'description', name: 'description', content: pkg.description },
],
- link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
+ link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
/*
@@ -59,7 +51,7 @@ module.exports = {
loading: {
color: '#86b31e',
height: '2px',
- duration: 20000
+ duration: 20000,
},
/*
@@ -71,7 +63,7 @@ module.exports = {
** Global processed styles
*/
styleResources: {
- scss: styleguideStyles
+ scss: styleguideStyles,
},
/*
@@ -80,7 +72,7 @@ module.exports = {
plugins: [
{
src: `~/plugins/styleguide${process.env.STYLEGUIDE_DEV ? '-dev' : ''}.js`,
- ssr: true
+ ssr: true,
},
{ src: '~/plugins/i18n.js', ssr: true },
{ src: '~/plugins/axios.js', ssr: false },
@@ -88,7 +80,7 @@ module.exports = {
{ src: '~/plugins/vue-directives.js', ssr: false },
{ src: '~/plugins/v-tooltip.js', ssr: false },
{ src: '~/plugins/izi-toast.js', ssr: false },
- { src: '~/plugins/vue-filters.js' }
+ { src: '~/plugins/vue-filters.js' },
],
router: {
@@ -97,7 +89,7 @@ module.exports = {
linkExactActiveClass: 'router-link-exact-active',
scrollBehavior: () => {
return { x: 0, y: 0 }
- }
+ },
},
/*
@@ -109,7 +101,7 @@ module.exports = {
'cookie-universal-nuxt',
'@nuxtjs/apollo',
'@nuxtjs/axios',
- '@nuxtjs/style-resources'
+ '@nuxtjs/style-resources',
],
/*
@@ -118,7 +110,7 @@ module.exports = {
axios: {
// See https://github.com/nuxt-community/axios-module#options
debug: dev,
- proxy: true
+ proxy: true,
},
proxy: {
'/.well-known/webfinger': {
@@ -127,8 +119,8 @@ module.exports = {
headers: {
Accept: 'application/json',
'X-UI-Request': true,
- 'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL'
- }
+ 'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL',
+ },
},
'/activitypub': {
// make this configurable (nuxt-dotenv)
@@ -137,8 +129,8 @@ module.exports = {
headers: {
Accept: 'application/json',
'X-UI-Request': true,
- 'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL'
- }
+ 'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL',
+ },
},
'/api': {
// make this configurable (nuxt-dotenv)
@@ -148,9 +140,9 @@ module.exports = {
headers: {
Accept: 'application/json',
'X-UI-Request': true,
- 'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL'
- }
- }
+ 'X-API-TOKEN': process.env.BACKEND_TOKEN || 'NULL',
+ },
+ },
},
// Give apollo module options
@@ -164,7 +156,7 @@ module.exports = {
console.log(
'%cError',
'background: red; color: white; padding: 2px 4px; border-radius: 3px; font-weight: bold;',
- error.message
+ error.message,
)
},
@@ -177,15 +169,15 @@ module.exports = {
// },
// required
clientConfigs: {
- default: '~/plugins/apollo-config.js'
- }
+ default: '~/plugins/apollo-config.js',
+ },
},
manifest: {
name: 'Human-Connection.org',
description: 'Human-Connection.org',
theme_color: '#ffffff',
- lang: 'de'
+ lang: 'de',
},
/*
@@ -198,15 +190,10 @@ module.exports = {
extend(config, ctx) {
if (process.env.STYLEGUIDE_DEV) {
const path = require('path')
- config.resolve.alias['@@'] = path.resolve(
- __dirname,
- `${styleguidePath}/src/system`
- )
+ config.resolve.alias['@@'] = path.resolve(__dirname, `${styleguidePath}/src/system`)
config.module.rules.push({
resourceQuery: /blockType=docs/,
- loader: require.resolve(
- `${styleguidePath}/src/loader/docs-trim-loader.js`
- )
+ loader: require.resolve(`${styleguidePath}/src/loader/docs-trim-loader.js`),
})
}
@@ -219,15 +206,15 @@ module.exports = {
svgo: {
plugins: [
{
- removeViewBox: false
+ removeViewBox: false,
},
{
- removeDimensions: true
- }
- ]
- }
- }
+ removeDimensions: true,
+ },
+ ],
+ },
+ },
})
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/admin.vue b/webapp/pages/admin.vue
index 6cacedef5..631338ef9 100644
--- a/webapp/pages/admin.vue
+++ b/webapp/pages/admin.vue
@@ -30,7 +30,7 @@ export default {
return [
{
name: this.$t('admin.dashboard.name'),
- path: `/admin`
+ path: `/admin`,
},
// TODO implement
/* {
@@ -54,19 +54,19 @@ export default {
}, */
{
name: this.$t('admin.categories.name'),
- path: `/admin/categories`
+ path: `/admin/categories`,
},
{
name: this.$t('admin.tags.name'),
- path: `/admin/tags`
- }
+ path: `/admin/tags`,
+ },
// TODO implement
/* {
name: this.$t('admin.settings.name'),
path: `/admin/settings`
} */
]
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/admin/categories.vue b/webapp/pages/admin/categories.vue
index 20739a661..4620b29ad 100644
--- a/webapp/pages/admin/categories.vue
+++ b/webapp/pages/admin/categories.vue
@@ -21,7 +21,7 @@ import gql from 'graphql-tag'
export default {
data() {
return {
- Category: []
+ Category: [],
}
},
computed: {
@@ -31,10 +31,10 @@ export default {
name: this.$t('admin.categories.categoryName'),
postCount: {
label: this.$t('admin.categories.postCount'),
- align: 'right'
- }
+ align: 'right',
+ },
}
- }
+ },
},
apollo: {
Category: {
@@ -48,8 +48,8 @@ export default {
postCount
}
}
- `)
- }
- }
+ `),
+ },
+ },
}
diff --git a/webapp/pages/admin/index.vue b/webapp/pages/admin/index.vue
index 349e372e8..d87cd8cc3 100644
--- a/webapp/pages/admin/index.vue
+++ b/webapp/pages/admin/index.vue
@@ -168,17 +168,17 @@ import HcCountTo from '~/components/CountTo.vue'
export default {
components: {
- HcCountTo
+ HcCountTo,
},
data() {
return {
- statistics: {}
+ statistics: {},
}
},
computed: {
isClient() {
return process.client
- }
+ },
},
mounted() {
this.$apollo.queries.statistics.startPolling(5000)
@@ -199,8 +199,8 @@ export default {
countShouts
}
}
- `)
- }
- }
+ `),
+ },
+ },
}
diff --git a/webapp/pages/admin/notifications.vue b/webapp/pages/admin/notifications.vue
index a51be6863..62be1b3bb 100644
--- a/webapp/pages/admin/notifications.vue
+++ b/webapp/pages/admin/notifications.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/admin/organizations.vue b/webapp/pages/admin/organizations.vue
index 13c62f267..f1e73b8cd 100644
--- a/webapp/pages/admin/organizations.vue
+++ b/webapp/pages/admin/organizations.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/admin/pages.vue b/webapp/pages/admin/pages.vue
index fae436782..789d8ad1c 100644
--- a/webapp/pages/admin/pages.vue
+++ b/webapp/pages/admin/pages.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/admin/settings.vue b/webapp/pages/admin/settings.vue
index fcd0c8397..95d34bc86 100644
--- a/webapp/pages/admin/settings.vue
+++ b/webapp/pages/admin/settings.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/admin/tags.vue b/webapp/pages/admin/tags.vue
index 03115f091..56fa45d59 100644
--- a/webapp/pages/admin/tags.vue
+++ b/webapp/pages/admin/tags.vue
@@ -21,7 +21,7 @@ import gql from 'graphql-tag'
export default {
data() {
return {
- Tag: []
+ Tag: [],
}
},
computed: {
@@ -31,14 +31,14 @@ export default {
name: 'Name',
taggedCountUnique: {
label: this.$t('admin.tags.tagCountUnique'),
- align: 'right'
+ align: 'right',
},
taggedCount: {
label: this.$t('admin.tags.tagCount'),
- align: 'right'
- }
+ align: 'right',
+ },
}
- }
+ },
},
apollo: {
Tag: {
@@ -51,8 +51,8 @@ export default {
taggedCountUnique
}
}
- `)
- }
- }
+ `),
+ },
+ },
}
diff --git a/webapp/pages/admin/users.vue b/webapp/pages/admin/users.vue
index b06e45b5f..e2958b638 100644
--- a/webapp/pages/admin/users.vue
+++ b/webapp/pages/admin/users.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue
index 26ff6296d..fa3061443 100644
--- a/webapp/pages/index.vue
+++ b/webapp/pages/index.vue
@@ -40,14 +40,14 @@ import HcLoadMore from '~/components/LoadMore.vue'
export default {
components: {
HcPostCard,
- HcLoadMore
+ HcLoadMore,
},
data() {
return {
// Initialize your apollo data
Post: [],
page: 1,
- pageSize: 10
+ pageSize: 10,
}
},
computed: {
@@ -56,7 +56,7 @@ export default {
},
offset() {
return (this.page - 1) * this.pageSize
- }
+ },
},
methods: {
uniq(items, field = 'id') {
@@ -65,7 +65,7 @@ export default {
href(post) {
return this.$router.resolve({
name: 'post-id-slug',
- params: { id: post.id, slug: post.slug }
+ params: { id: post.id, slug: post.slug },
}).href
},
showMoreContributions() {
@@ -75,7 +75,7 @@ export default {
this.$apollo.queries.Post.fetchMore({
variables: {
first: this.pageSize,
- offset: this.offset
+ offset: this.offset,
},
// Transform the previous result with new data
updateQuery: (previousResult, { fetchMoreResult }) => {
@@ -83,9 +83,9 @@ export default {
output.Post = [...previousResult.Post, ...fetchMoreResult.Post]
return output
},
- fetchPolicy: 'cache-and-network'
+ fetchPolicy: 'cache-and-network',
})
- }
+ },
},
apollo: {
Post: {
@@ -136,12 +136,12 @@ export default {
variables() {
return {
first: this.pageSize,
- offset: 0
+ offset: 0,
}
},
- fetchPolicy: 'cache-and-network'
- }
- }
+ fetchPolicy: 'cache-and-network',
+ },
+ },
}
diff --git a/webapp/pages/login.vue b/webapp/pages/login.vue
index 46c6e2d79..9a984298e 100644
--- a/webapp/pages/login.vue
+++ b/webapp/pages/login.vue
@@ -82,9 +82,7 @@
:href="$t('login.moreInfoURL')"
:title="$t('login.moreInfoHint')"
target="_blank"
- >
- {{ $t('login.moreInfo') }}
-
+ >{{ $t('login.moreInfo') }}
@@ -97,11 +95,9 @@
diff --git a/webapp/pages/logout.vue b/webapp/pages/logout.vue
index 008908360..a7efb0fb8 100644
--- a/webapp/pages/logout.vue
+++ b/webapp/pages/logout.vue
@@ -41,6 +41,6 @@ export default {
async beforeCreate() {
await this.$store.dispatch('auth/logout')
this.$router.replace('/')
- }
+ },
}
diff --git a/webapp/pages/moderation.vue b/webapp/pages/moderation.vue
index 6b151b0e4..5205020fa 100644
--- a/webapp/pages/moderation.vue
+++ b/webapp/pages/moderation.vue
@@ -27,10 +27,10 @@ export default {
return [
{
name: this.$t('moderation.reports.name'),
- path: `/moderation`
- }
+ path: `/moderation`,
+ },
]
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/moderation/index.vue b/webapp/pages/moderation/index.vue
index fc5d1fbe6..97c1a2af1 100644
--- a/webapp/pages/moderation/index.vue
+++ b/webapp/pages/moderation/index.vue
@@ -14,9 +14,12 @@
slot-scope="scope"
>
-
+
{{ scope.row.post.title | truncate(50) }}
-
+
+
-
+
{{ scope.row.comment.contentExcerpt | truncate(50) }}
-
+
+
-
+
{{ scope.row.user.name | truncate(50) }}
@@ -45,9 +53,7 @@
slot="type"
slot-scope="scope"
>
-
+
-
+
{{ scope.row.submitter.name }}
@@ -106,17 +114,16 @@
diff --git a/webapp/pages/post/_id.vue b/webapp/pages/post/_id.vue
index d8fc5d4f9..ab6ec0687 100644
--- a/webapp/pages/post/_id.vue
+++ b/webapp/pages/post/_id.vue
@@ -41,7 +41,7 @@ const options = {
}
`,
path: 'post',
- message: 'This post could not be found'
+ message: 'This post could not be found',
}
const persistentLinks = PersistentLinks(options)
@@ -57,8 +57,8 @@ export default {
children: [
{
name: this.$t('common.comment', null, 2),
- path: `/post/${id}/${slug}#comments`
- }
+ path: `/post/${id}/${slug}#comments`,
+ },
// TODO implement
/* {
name: this.$t('common.letsTalk'),
@@ -69,20 +69,20 @@ export default {
name: this.$t('common.versus'),
path: `/post/${id}/${slug}#versus`
} */
- ]
+ ],
},
{
name: this.$t('common.moreInfo'),
- path: `/post/${id}/${slug}/more-info`
- }
+ path: `/post/${id}/${slug}/more-info`,
+ },
// TODO implement
/* {
name: this.$t('common.takeAction'),
path: `/post/${id}/${slug}/take-action`
} */
]
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue
index ad04f8421..b0718f893 100644
--- a/webapp/pages/post/_id/_slug/index.vue
+++ b/webapp/pages/post/_id/_slug/index.vue
@@ -94,7 +94,7 @@ import HcCommentList from '~/components/comments/CommentList'
export default {
transition: {
name: 'slide-up',
- mode: 'out-in'
+ mode: 'out-in',
},
components: {
HcTag,
@@ -103,31 +103,31 @@ export default {
HcShoutButton,
ContentMenu,
HcCommentForm,
- HcCommentList
+ HcCommentList,
},
head() {
return {
- title: this.title
+ title: this.title,
}
},
data() {
return {
post: null,
ready: false,
- title: 'loading'
+ title: 'loading',
}
},
watch: {
Post(post) {
this.post = post[0] || {}
this.title = this.post.title
- }
+ },
},
async asyncData(context) {
const {
params,
error,
- app: { apolloProvider, $i18n }
+ app: { apolloProvider, $i18n },
} = context
const client = apolloProvider.defaultClient
const query = gql(`
@@ -206,7 +206,7 @@ export default {
`)
const variables = { slug: params.slug }
const {
- data: { Post }
+ data: { Post },
} = await client.query({ query, variables })
if (Post.length <= 0) {
// TODO: custom 404 error page with translations
@@ -216,7 +216,7 @@ export default {
const [post] = Post
return {
post,
- title: post.title
+ title: post.title,
}
},
mounted() {
@@ -229,8 +229,8 @@ export default {
methods: {
isAuthor(id) {
return this.$store.getters['auth/user'].id === id
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/post/_id/_slug/more-info.vue b/webapp/pages/post/_id/_slug/more-info.vue
index ae03fe658..e18ab8f57 100644
--- a/webapp/pages/post/_id/_slug/more-info.vue
+++ b/webapp/pages/post/_id/_slug/more-info.vue
@@ -62,16 +62,16 @@ import HcEmpty from '~/components/Empty.vue'
export default {
transition: {
name: 'slide-up',
- mode: 'out-in'
+ mode: 'out-in',
},
components: {
HcPostCard,
- HcEmpty
+ HcEmpty,
},
computed: {
post() {
return this.Post ? this.Post[0] || {} : {}
- }
+ },
},
apollo: {
Post: {
@@ -128,11 +128,11 @@ export default {
},
variables() {
return {
- slug: this.$route.params.slug
+ slug: this.$route.params.slug,
}
- }
- }
- }
+ },
+ },
+ },
}
diff --git a/webapp/pages/post/_id/_slug/take-action.vue b/webapp/pages/post/_id/_slug/take-action.vue
index 35cbe30fc..1dfb75208 100644
--- a/webapp/pages/post/_id/_slug/take-action.vue
+++ b/webapp/pages/post/_id/_slug/take-action.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/post/create.vue b/webapp/pages/post/create.vue
index fd8b493d3..a110965db 100644
--- a/webapp/pages/post/create.vue
+++ b/webapp/pages/post/create.vue
@@ -13,12 +13,11 @@
diff --git a/webapp/pages/post/edit/_id.vue b/webapp/pages/post/edit/_id.vue
index cb61e2b40..2420a85b9 100644
--- a/webapp/pages/post/edit/_id.vue
+++ b/webapp/pages/post/edit/_id.vue
@@ -18,7 +18,7 @@ import HcContributionForm from '~/components/ContributionForm'
export default {
components: {
- HcContributionForm
+ HcContributionForm,
},
computed: {
user() {
@@ -29,14 +29,14 @@ export default {
},
contribution() {
return this.Post ? this.Post[0] : {}
- }
+ },
},
watch: {
contribution() {
if (this.author.id !== this.user.id) {
throw new Error(`You can't edit that!`)
}
- }
+ },
},
apollo: {
Post: {
@@ -71,11 +71,11 @@ export default {
},
variables() {
return {
- id: this.$route.params.id || 'p1'
+ id: this.$route.params.id || 'p1',
}
},
- fetchPolicy: 'cache-and-network'
- }
- }
+ fetchPolicy: 'cache-and-network',
+ },
+ },
}
diff --git a/webapp/pages/profile/_id.vue b/webapp/pages/profile/_id.vue
index 4d436146c..992e5efce 100644
--- a/webapp/pages/profile/_id.vue
+++ b/webapp/pages/profile/_id.vue
@@ -24,11 +24,11 @@ const options = {
}
`,
message: 'This user could not be found',
- path: 'profile'
+ path: 'profile',
}
const persistentLinks = PersistentLinks(options)
export default {
- mixins: [persistentLinks]
+ mixins: [persistentLinks],
}
diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue
index 266a3f9c6..3dfb2c751 100644
--- a/webapp/pages/profile/_id/_slug.vue
+++ b/webapp/pages/profile/_id/_slug.vue
@@ -337,18 +337,18 @@ export default {
HcBadges,
HcLoadMore,
HcEmpty,
- ContentMenu
+ ContentMenu,
},
transition: {
name: 'slide-up',
- mode: 'out-in'
+ mode: 'out-in',
},
data() {
return {
User: [],
voted: false,
page: 1,
- pageSize: 6
+ pageSize: 6,
}
},
computed: {
@@ -367,8 +367,7 @@ export default {
},
hasMore() {
return (
- this.user.contributions &&
- this.user.contributions.length < this.user.contributionsCount
+ this.user.contributions && this.user.contributions.length < this.user.contributionsCount
)
},
activePosts() {
@@ -381,9 +380,7 @@ export default {
const { socialMedia = [] } = this.user
return socialMedia.map(socialMedia => {
const { url } = socialMedia
- const matches = url.match(
- /^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
- )
+ const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:/\n?]+)/g)
const [domain] = matches || []
const favicon = domain ? `${domain}/favicon.ico` : null
const username = url.split('/').pop()
@@ -393,14 +390,14 @@ export default {
userName() {
const { name } = this.user || {}
return name || this.$t('profile.userAnonym')
- }
+ },
},
watch: {
User(val) {
if (!val || !val.length) {
throw new Error('User not found!')
}
- }
+ },
},
methods: {
uniq(items, field = 'id') {
@@ -418,20 +415,20 @@ export default {
variables: {
slug: this.$route.params.slug,
first: this.pageSize,
- offset: this.offset
+ offset: this.offset,
},
// Transform the previous result with new data
updateQuery: (previousResult, { fetchMoreResult }) => {
let output = { User: this.User }
output.User[0].contributions = [
...previousResult.User[0].contributions,
- ...fetchMoreResult.User[0].contributions
+ ...fetchMoreResult.User[0].contributions,
]
return output
},
- fetchPolicy: 'cache-and-network'
+ fetchPolicy: 'cache-and-network',
})
- }
+ },
},
apollo: {
User: {
@@ -442,12 +439,12 @@ export default {
return {
slug: this.$route.params.slug,
first: this.pageSize,
- offset: 0
+ offset: 0,
}
},
- fetchPolicy: 'cache-and-network'
- }
- }
+ fetchPolicy: 'cache-and-network',
+ },
+ },
}
diff --git a/webapp/pages/settings.vue b/webapp/pages/settings.vue
index 68b7c6d31..48eab45ff 100644
--- a/webapp/pages/settings.vue
+++ b/webapp/pages/settings.vue
@@ -29,16 +29,16 @@ export default {
return [
{
name: this.$t('settings.data.name'),
- path: `/settings`
+ path: `/settings`,
},
{
name: this.$t('settings.security.name'),
- path: `/settings/security`
+ path: `/settings/security`,
},
{
name: this.$t('settings.social-media.name'),
- path: `/settings/my-social-media`
- }
+ path: `/settings/my-social-media`,
+ },
// TODO implement
/* {
name: this.$t('settings.invites.name'),
@@ -66,7 +66,7 @@ export default {
},
} */
]
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/settings/data-download.vue b/webapp/pages/settings/data-download.vue
index 4bb70de24..5c9e5a24a 100644
--- a/webapp/pages/settings/data-download.vue
+++ b/webapp/pages/settings/data-download.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/settings/delete-account.vue b/webapp/pages/settings/delete-account.vue
index 77e8b542b..5f488fed1 100644
--- a/webapp/pages/settings/delete-account.vue
+++ b/webapp/pages/settings/delete-account.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/settings/index.spec.js b/webapp/pages/settings/index.spec.js
index 8ee68172e..f0eff0641 100644
--- a/webapp/pages/settings/index.spec.js
+++ b/webapp/pages/settings/index.spec.js
@@ -1,6 +1,5 @@
import { mount, createLocalVue } from '@vue/test-utils'
import index from './index.vue'
-import Vue from 'vue'
import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide'
@@ -10,7 +9,6 @@ localVue.use(Vuex)
localVue.use(Styleguide)
describe('index.vue', () => {
- let Wrapper
let store
let mocks
let getters
@@ -28,27 +26,27 @@ describe('index.vue', () => {
id: 'u1',
name: 'Peter',
locationName: 'Berlin',
- about: 'Smth'
- }
- }
- })
+ about: 'Smth',
+ },
+ },
+ }),
},
$toast: {
error: jest.fn(),
- success: jest.fn()
- }
+ success: jest.fn(),
+ },
}
getters = {
'auth/user': () => {
return {}
- }
+ },
}
})
describe('mount', () => {
const Wrapper = () => {
store = new Vuex.Store({
- getters
+ getters,
})
return mount(index, { store, mocks, localVue })
}
diff --git a/webapp/pages/settings/index.vue b/webapp/pages/settings/index.vue
index a3b2298c3..18e251bbc 100644
--- a/webapp/pages/settings/index.vue
+++ b/webapp/pages/settings/index.vue
@@ -51,11 +51,11 @@ import gql from 'graphql-tag'
import { mapGetters, mapMutations } from 'vuex'
import { CancelToken } from 'axios'
-import find from 'lodash/find'
let timeout
const mapboxToken = process.env.MAPBOX_TOKEN
+/*
const query = gql`
query getUser($id: ID) {
User(id: $id) {
@@ -66,15 +66,11 @@ const query = gql`
}
}
`
+*/
const mutation = gql`
mutation($id: ID!, $name: String, $locationName: String, $about: String) {
- UpdateUser(
- id: $id
- name: $name
- locationName: $locationName
- about: $about
- ) {
+ UpdateUser(id: $id, name: $name, locationName: $locationName, about: $about) {
id
name
locationName
@@ -90,12 +86,12 @@ export default {
cities: [],
loadingData: false,
loadingGeo: false,
- formData: {}
+ formData: {},
}
},
computed: {
...mapGetters({
- currentUser: 'auth/user'
+ currentUser: 'auth/user',
}),
form: {
get: function() {
@@ -104,12 +100,12 @@ export default {
},
set: function(formData) {
this.formData = formData
- }
- }
+ },
+ },
},
methods: {
...mapMutations({
- setCurrentUser: 'auth/SET_USER'
+ setCurrentUser: 'auth/SET_USER',
}),
async submit() {
this.loadingData = true
@@ -117,13 +113,13 @@ export default {
let { locationName } = this.formData
locationName = locationName && (locationName['label'] || locationName)
try {
- const { data } = await this.$apollo.mutate({
+ await this.$apollo.mutate({
mutation,
variables: {
id: this.currentUser.id,
name,
locationName,
- about
+ about,
},
update: (store, { data: { UpdateUser } }) => {
const { name, locationName, about } = UpdateUser
@@ -131,9 +127,9 @@ export default {
...this.currentUser,
name,
locationName,
- about
+ about,
})
- }
+ },
})
this.$toast.success(this.$t('settings.data.success'))
} catch (err) {
@@ -147,12 +143,7 @@ export default {
timeout = setTimeout(() => this.requestGeoData(value), 500)
},
processCityResults(res) {
- if (
- !res ||
- !res.data ||
- !res.data.features ||
- !res.data.features.length
- ) {
+ if (!res || !res.data || !res.data.features || !res.data.features.length) {
return []
}
let output = []
@@ -160,7 +151,7 @@ export default {
output.push({
label: item.place_name,
value: item.place_name,
- id: item.id
+ id: item.id,
})
})
@@ -188,8 +179,8 @@ export default {
.get(
`https://api.mapbox.com/geocoding/v5/mapbox.places/${place}.json?access_token=${mapboxToken}&types=region,place,country&language=${lang}`,
{
- cancelToken: this.axiosSource.token
- }
+ cancelToken: this.axiosSource.token,
+ },
)
.then(res => {
this.cities = this.processCityResults(res)
@@ -197,7 +188,7 @@ export default {
.finally(() => {
this.loadingGeo = false
})
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/settings/invites.vue b/webapp/pages/settings/invites.vue
index 7ef6f66fc..947d0b333 100644
--- a/webapp/pages/settings/invites.vue
+++ b/webapp/pages/settings/invites.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/settings/languages.vue b/webapp/pages/settings/languages.vue
index 52367f85b..7879d6425 100644
--- a/webapp/pages/settings/languages.vue
+++ b/webapp/pages/settings/languages.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/settings/my-organizations.vue b/webapp/pages/settings/my-organizations.vue
index 2b38f71aa..f651cbc61 100644
--- a/webapp/pages/settings/my-organizations.vue
+++ b/webapp/pages/settings/my-organizations.vue
@@ -12,7 +12,7 @@ import HcEmpty from '~/components/Empty.vue'
export default {
components: {
- HcEmpty
- }
+ HcEmpty,
+ },
}
diff --git a/webapp/pages/settings/my-social-media.spec.js b/webapp/pages/settings/my-social-media.spec.js
index 559ba87d2..34793e066 100644
--- a/webapp/pages/settings/my-social-media.spec.js
+++ b/webapp/pages/settings/my-social-media.spec.js
@@ -1,6 +1,5 @@
import { mount, createLocalVue } from '@vue/test-utils'
import MySocialMedia from './my-social-media.vue'
-import Vue from 'vue'
import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide'
@@ -11,7 +10,6 @@ localVue.use(Styleguide)
describe('my-social-media.vue', () => {
let wrapper
- let Wrapper
let store
let mocks
let getters
@@ -27,25 +25,25 @@ describe('my-social-media.vue', () => {
.fn()
.mockRejectedValue({ message: 'Ouch!' })
.mockResolvedValueOnce({
- data: { CreateSocialMeda: { id: 's1', url: socialMediaUrl } }
- })
+ data: { CreateSocialMeda: { id: 's1', url: socialMediaUrl } },
+ }),
},
$toast: {
error: jest.fn(),
- success: jest.fn()
- }
+ success: jest.fn(),
+ },
}
getters = {
'auth/user': () => {
return {}
- }
+ },
}
})
describe('mount', () => {
const Wrapper = () => {
store = new Vuex.Store({
- getters
+ getters,
})
return mount(MySocialMedia, { store, mocks, localVue })
}
@@ -60,9 +58,9 @@ describe('my-social-media.vue', () => {
getters = {
'auth/user': () => {
return {
- socialMedia: [{ id: 's1', url: socialMediaUrl }]
+ socialMedia: [{ id: 's1', url: socialMediaUrl }],
}
- }
+ },
}
})
@@ -80,20 +78,20 @@ describe('my-social-media.vue', () => {
.fn()
.mockRejectedValue({ message: 'Ouch!' })
.mockResolvedValueOnce({
- data: { DeleteSocialMeda: { id: 's1', url: socialMediaUrl } }
- })
+ data: { DeleteSocialMeda: { id: 's1', url: socialMediaUrl } },
+ }),
},
$toast: {
error: jest.fn(),
- success: jest.fn()
- }
+ success: jest.fn(),
+ },
}
getters = {
'auth/user': () => {
return {
- socialMedia: [{ id: 's1', url: socialMediaUrl }]
+ socialMedia: [{ id: 's1', url: socialMediaUrl }],
}
- }
+ },
}
})
diff --git a/webapp/pages/settings/my-social-media.vue b/webapp/pages/settings/my-social-media.vue
index 95a61bdd8..745e2f776 100644
--- a/webapp/pages/settings/my-social-media.vue
+++ b/webapp/pages/settings/my-social-media.vue
@@ -22,7 +22,8 @@
/>
{{ link.url }}
- |
+
+ |
{
const { id, url } = socialMedia
- const matches = url.match(
- /^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
- )
+ const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:/\n?]+)/g)
const [domain] = matches || []
const favicon = domain ? `${domain}/favicon.ico` : null
return { id, url, favicon }
})
- }
+ },
},
methods: {
...mapMutations({
- setCurrentUser: 'auth/SET_USER'
+ setCurrentUser: 'auth/SET_USER',
}),
handleAddSocialMedia() {
this.$apollo
@@ -105,22 +104,19 @@ export default {
}
`,
variables: {
- url: this.value
+ url: this.value,
},
update: (store, { data }) => {
- const socialMedia = [
- ...this.currentUser.socialMedia,
- data.CreateSocialMedia
- ]
+ const socialMedia = [...this.currentUser.socialMedia, data.CreateSocialMedia]
this.setCurrentUser({
...this.currentUser,
- socialMedia
+ socialMedia,
})
- }
+ },
})
.then(() => {
- this.$toast.success(this.$t('settings.social-media.successAdd')),
- (this.value = '')
+ this.$toast.success(this.$t('settings.social-media.successAdd'))
+ this.value = ''
})
.catch(error => {
this.$toast.error(error.message)
@@ -138,17 +134,17 @@ export default {
}
`,
variables: {
- id: link.id
+ id: link.id,
},
update: (store, { data }) => {
const socialMedia = this.currentUser.socialMedia.filter(
- element => element.id !== link.id
+ element => element.id !== link.id,
)
this.setCurrentUser({
...this.currentUser,
- socialMedia
+ socialMedia,
})
- }
+ },
})
.then(() => {
this.$toast.success(this.$t('settings.social-media.successDelete'))
@@ -156,8 +152,8 @@ export default {
.catch(error => {
this.$toast.error(error.message)
})
- }
- }
+ },
+ },
}
diff --git a/webapp/pages/settings/security.vue b/webapp/pages/settings/security.vue
index ac95ff26e..e1c8ca0e0 100644
--- a/webapp/pages/settings/security.vue
+++ b/webapp/pages/settings/security.vue
@@ -5,12 +5,11 @@
diff --git a/webapp/plugins/apollo-config.js b/webapp/plugins/apollo-config.js
index f65700ab4..83ec452e3 100644
--- a/webapp/plugins/apollo-config.js
+++ b/webapp/plugins/apollo-config.js
@@ -3,11 +3,11 @@ export default ({ app }) => {
return {
httpEndpoint: process.server ? backendUrl : '/api',
httpLinkOptions: {
- credentials: 'same-origin'
+ credentials: 'same-origin',
},
credentials: true,
tokenName: 'human-connection-token',
persisting: false,
- websocketsOnly: false
+ websocketsOnly: false,
}
}
diff --git a/webapp/plugins/i18n.js b/webapp/plugins/i18n.js
index 836ba220f..b568ca39e 100644
--- a/webapp/plugins/i18n.js
+++ b/webapp/plugins/i18n.js
@@ -1,7 +1,6 @@
import Vue from 'vue'
-import Vuex from 'vuex'
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'
-import { debounce, isEmpty, find } from 'lodash'
+import { isEmpty, find } from 'lodash'
/**
* TODO: Refactor and simplify browser detection
@@ -48,11 +47,9 @@ export default ({ app, req, cookie, store }) => {
onTranslationNotFound: function(locale, key) {
if (debug) {
/* eslint-disable-next-line no-console */
- console.warn(
- `vuex-i18n :: Key '${key}' not found for locale '${locale}'`
- )
+ console.warn(`vuex-i18n :: Key '${key}' not found for locale '${locale}'`)
}
- }
+ },
})
// register the fallback locales
@@ -80,9 +77,7 @@ export default ({ app, req, cookie, store }) => {
}
const availableLocales = process.env.locales.filter(lang => !!lang.enabled)
- const locale = find(availableLocales, ['code', userLocale])
- ? userLocale
- : 'en'
+ const locale = find(availableLocales, ['code', userLocale]) ? userLocale : 'en'
if (locale !== 'en') {
Vue.i18n.add(locale, require(`~/locales/${locale}.json`))
diff --git a/webapp/plugins/izi-toast.js b/webapp/plugins/izi-toast.js
index 5900898ac..8bb41c961 100644
--- a/webapp/plugins/izi-toast.js
+++ b/webapp/plugins/izi-toast.js
@@ -8,6 +8,6 @@ export default ({ app }) => {
position: 'bottomRight',
transitionIn: 'bounceInLeft',
layout: 2,
- theme: 'dark'
+ theme: 'dark',
})
}
diff --git a/webapp/plugins/keep-alive.js b/webapp/plugins/keep-alive.js
index 93a8a1767..91d7ed1f0 100644
--- a/webapp/plugins/keep-alive.js
+++ b/webapp/plugins/keep-alive.js
@@ -24,7 +24,7 @@ if (!process.server) {
if (this.$metaInfo && !keepAlivePages.includes(lastRoute)) {
this.$destroy()
}
- }
+ },
})
}
Vue.use(keepAliveHook)
diff --git a/webapp/plugins/v-tooltip.js b/webapp/plugins/v-tooltip.js
index a018ec5f3..77d0ac1b8 100644
--- a/webapp/plugins/v-tooltip.js
+++ b/webapp/plugins/v-tooltip.js
@@ -4,13 +4,13 @@ import VTooltip from 'v-tooltip'
Vue.use(VTooltip, {
defaultDelay: {
show: 500,
- hide: 50
+ hide: 50,
},
defaultOffset: 2,
defaultPopperOptions: {
- removeOnDestroy: true
+ removeOnDestroy: true,
},
popover: {
// defaultArrowClass: 'm-dropdown__arrow'
- }
+ },
})
diff --git a/webapp/plugins/vue-directives.js b/webapp/plugins/vue-directives.js
index 618bbd4e2..f54c02167 100644
--- a/webapp/plugins/vue-directives.js
+++ b/webapp/plugins/vue-directives.js
@@ -10,7 +10,7 @@ export default ({ app }) => {
el.focus()
}
})
- }
+ },
})
Vue.directive('router-link', {
@@ -28,6 +28,6 @@ export default ({ app }) => {
if (binding.clickEventListener) {
el.removeEventListener('click', binding.clickEventListener)
}
- }
+ },
})
}
diff --git a/webapp/plugins/vue-filters.js b/webapp/plugins/vue-filters.js
index bf59a7dba..aad978d72 100644
--- a/webapp/plugins/vue-filters.js
+++ b/webapp/plugins/vue-filters.js
@@ -2,7 +2,6 @@ import Vue from 'vue'
import { enUS, de, nl, fr, es } from 'date-fns/locale'
import format from 'date-fns/format'
-import formatRelative from 'date-fns/formatRelative'
import addSeconds from 'date-fns/addSeconds'
import accounting from 'accounting'
@@ -14,7 +13,7 @@ export default ({ app = {} }) => {
fr: fr,
es: es,
pt: es,
- pl: de
+ pl: de,
}
const getLocalizedFormat = () => {
let locale = app.$i18n.locale()
@@ -25,22 +24,16 @@ export default ({ app = {} }) => {
date: (value, fmt = 'dd. MMM yyyy') => {
if (!value) return ''
return format(new Date(value), fmt, {
- locale: getLocalizedFormat()
+ locale: getLocalizedFormat(),
})
},
dateTime: (value, fmt = 'dd. MMM yyyy HH:mm') => {
if (!value) return ''
return format(new Date(value), fmt, {
- locale: getLocalizedFormat()
+ locale: getLocalizedFormat(),
})
},
- number: (
- value,
- precision = 2,
- thousands = '.',
- decimals = ',',
- fallback = null
- ) => {
+ number: (value, precision = 2, thousands = '.', decimals = ',', fallback = null) => {
if (isNaN(value) && fallback) {
return fallback
}
@@ -99,7 +92,7 @@ export default ({ app = {} }) => {
}
return excerpt
- }
+ },
})
// add all methods as filters on each vue component
diff --git a/webapp/server/index.js b/webapp/server/index.js
index 66738790e..d06bb1f6d 100644
--- a/webapp/server/index.js
+++ b/webapp/server/index.js
@@ -30,7 +30,7 @@ async function start() {
app.listen(port, host)
consola.ready({
message: `Server listening on http://${host}:${port}`,
- badge: true
+ badge: true,
})
}
start()
diff --git a/webapp/store/auth.js b/webapp/store/auth.js
index ca1b453ba..87de84d9a 100644
--- a/webapp/store/auth.js
+++ b/webapp/store/auth.js
@@ -1,11 +1,10 @@
import gql from 'graphql-tag'
-import jwt from 'jsonwebtoken'
export const state = () => {
return {
user: null,
token: null,
- pending: false
+ pending: false,
}
}
@@ -18,7 +17,7 @@ export const mutations = {
},
SET_PENDING(state, pending) {
state.pending = pending
- }
+ },
}
export const getters = {
@@ -35,17 +34,14 @@ export const getters = {
return !!state.user && state.user.role === 'admin'
},
isModerator(state) {
- return (
- !!state.user &&
- (state.user.role === 'admin' || state.user.role === 'moderator')
- )
+ return !!state.user && (state.user.role === 'admin' || state.user.role === 'moderator')
},
user(state) {
return state.user || {}
},
token(state) {
return state.token
- }
+ },
}
export const actions = {
@@ -71,7 +67,7 @@ export const actions = {
async fetchCurrentUser({ commit, dispatch }) {
const client = this.app.apolloProvider.defaultClient
const {
- data: { currentUser }
+ data: { currentUser },
} = await client.query({
query: gql(`{
currentUser {
@@ -105,7 +101,7 @@ export const actions = {
}
}
}
- }`)
+ }`),
})
if (!currentUser) return dispatch('logout')
commit('SET_USER', currentUser)
@@ -117,14 +113,14 @@ export const actions = {
try {
const client = this.app.apolloProvider.defaultClient
const {
- data: { login }
+ data: { login },
} = await client.mutate({
mutation: gql(`
mutation($email: String!, $password: String!) {
login(email: $email, password: $password)
}
`),
- variables: { email, password }
+ variables: { email, password },
})
await this.app.$apolloHelpers.onLogin(login)
commit('SET_TOKEN', login)
@@ -142,12 +138,9 @@ export const actions = {
return this.app.$apolloHelpers.onLogout()
},
- register(
- { dispatch, commit },
- { email, password, inviteCode, invitedByUserId }
- ) {},
+ register({ dispatch, commit }, { email, password, inviteCode, invitedByUserId }) {},
async patch({ state, commit, dispatch }, data) {},
resendVerifySignup({ state, dispatch }) {},
resetPassword({ state }, data) {},
- setNewPassword({ state }, data) {}
+ setNewPassword({ state }, data) {},
}
diff --git a/webapp/store/auth.test.js b/webapp/store/auth.test.js
index 9b6a33195..e45fec693 100644
--- a/webapp/store/auth.test.js
+++ b/webapp/store/auth.test.js
@@ -1,4 +1,4 @@
-import { getters, mutations, actions } from './auth.js'
+import { getters, actions } from './auth.js'
let state
let commit
@@ -12,14 +12,15 @@ const currentUser = {
slug: 'jenny-rostock',
email: 'user@example.org',
avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg',
- role: 'user'
+ role: 'user',
}
const successfulLoginResponse = { data: { login: token } }
const successfulCurrentUserResponse = { data: { currentUser } }
+/*
const incorrectPasswordResponse = {
data: {
- login: null
+ login: null,
},
errors: [
{
@@ -27,13 +28,14 @@ const incorrectPasswordResponse = {
locations: [
{
line: 2,
- column: 3
- }
+ column: 3,
+ },
],
- path: ['login']
- }
- ]
+ path: ['login'],
+ },
+ ],
}
+*/
beforeEach(() => {
commit = jest.fn()
@@ -59,9 +61,9 @@ describe('actions', () => {
const module = {
app: {
$apolloHelpers: {
- getToken: () => token
- }
- }
+ getToken: () => token,
+ },
+ },
}
action = actions.init.bind(module)
return action({ commit, dispatch })
@@ -91,9 +93,7 @@ describe('actions', () => {
it('saves the JWT Bearer token', async () => {
await theAction()
- expect(commit.mock.calls).toEqual(
- expect.arrayContaining([['SET_TOKEN', token]])
- )
+ expect(commit.mock.calls).toEqual(expect.arrayContaining([['SET_TOKEN', token]]))
})
})
})
@@ -105,12 +105,10 @@ describe('actions', () => {
app: {
apolloProvider: {
defaultClient: {
- query: jest.fn(() =>
- Promise.resolve(successfulCurrentUserResponse)
- )
- }
- }
- }
+ query: jest.fn(() => Promise.resolve(successfulCurrentUserResponse)),
+ },
+ },
+ },
}
action = actions.fetchCurrentUser.bind(module)
await action({ commit })
@@ -126,12 +124,11 @@ describe('actions', () => {
name: 'Jenny Rostock',
slug: 'jenny-rostock',
email: 'user@example.org',
- avatar:
- 'https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg',
- role: 'user'
- }
- ]
- ])
+ avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg',
+ role: 'user',
+ },
+ ],
+ ]),
)
})
})
@@ -144,19 +141,16 @@ describe('actions', () => {
app: {
apolloProvider: {
defaultClient: {
- mutate: jest.fn(() => Promise.resolve(successfulLoginResponse))
- }
+ mutate: jest.fn(() => Promise.resolve(successfulLoginResponse)),
+ },
},
$apolloHelpers: {
- onLogin: jest.fn(() => Promise.resolve())
- }
- }
+ onLogin: jest.fn(() => Promise.resolve()),
+ },
+ },
}
action = actions.login.bind(module)
- await action(
- { commit, dispatch },
- { email: 'user@example.org', password: '1234' }
- )
+ await action({ commit, dispatch }, { email: 'user@example.org', password: '1234' })
})
afterEach(() => {
@@ -164,9 +158,7 @@ describe('actions', () => {
})
it('saves the JWT Bearer token', () => {
- expect(commit.mock.calls).toEqual(
- expect.arrayContaining([['SET_TOKEN', token]])
- )
+ expect(commit.mock.calls).toEqual(expect.arrayContaining([['SET_TOKEN', token]]))
})
it('fetches the user', () => {
@@ -175,10 +167,7 @@ describe('actions', () => {
it('saves pending flags in order', () => {
expect(commit.mock.calls).toEqual(
- expect.arrayContaining([
- ['SET_PENDING', true],
- ['SET_PENDING', false]
- ])
+ expect.arrayContaining([['SET_PENDING', true], ['SET_PENDING', false]]),
)
})
})
@@ -188,13 +177,13 @@ describe('actions', () => {
let mutate
beforeEach(() => {
- mutate = jest.fn(() => Promise.reject('This error is expected.'))
+ mutate = jest.fn(() => Promise.reject('This error is expected.')) // eslint-disable-line prefer-promise-reject-errors
onLogin = jest.fn(() => Promise.resolve())
const module = {
app: {
apolloProvider: { defaultClient: { mutate } },
- $apolloHelpers: { onLogin }
- }
+ $apolloHelpers: { onLogin },
+ },
}
action = actions.login.bind(module)
})
@@ -205,7 +194,7 @@ describe('actions', () => {
it('populates error messages', async () => {
expect(
- action({ commit }, { email: 'user@example.org', password: 'wrong' })
+ action({ commit }, { email: 'user@example.org', password: 'wrong' }),
).rejects.toThrowError('This error is expected.')
expect(mutate).toHaveBeenCalled()
expect(onLogin).not.toHaveBeenCalled()
@@ -213,16 +202,10 @@ describe('actions', () => {
it('saves pending flags in order', async () => {
try {
- await action(
- { commit },
- { email: 'user@example.org', password: 'wrong' }
- )
+ await action({ commit }, { email: 'user@example.org', password: 'wrong' })
} catch (err) {} // ignore
expect(commit.mock.calls).toEqual(
- expect.arrayContaining([
- ['SET_PENDING', true],
- ['SET_PENDING', false]
- ])
+ expect.arrayContaining([['SET_PENDING', true], ['SET_PENDING', false]]),
)
})
})
diff --git a/webapp/store/index.js b/webapp/store/index.js
index 91be021a5..8bc4ed563 100644
--- a/webapp/store/index.js
+++ b/webapp/store/index.js
@@ -5,5 +5,5 @@ export const mutations = {}
export const actions = {
async nuxtServerInit({ dispatch }) {
await dispatch('auth/init')
- }
+ },
}
diff --git a/webapp/store/modal.js b/webapp/store/modal.js
index f7bc1ad8e..72617f592 100644
--- a/webapp/store/modal.js
+++ b/webapp/store/modal.js
@@ -1,7 +1,7 @@
export const state = () => {
return {
open: null,
- data: {}
+ data: {},
}
}
@@ -9,7 +9,7 @@ export const mutations = {
SET_OPEN(state, ctx) {
state.open = ctx.name || null
state.data = ctx.data || {}
- }
+ },
}
export const getters = {
@@ -18,5 +18,5 @@ export const getters = {
},
data(state) {
return state.data
- }
+ },
}
diff --git a/webapp/store/notifications.js b/webapp/store/notifications.js
index cfb41e333..8e9b333b4 100644
--- a/webapp/store/notifications.js
+++ b/webapp/store/notifications.js
@@ -3,7 +3,7 @@ import gql from 'graphql-tag'
export const state = () => {
return {
notifications: null,
- pending: false
+ pending: false,
}
}
@@ -19,13 +19,13 @@ export const mutations = {
const toBeUpdated = notifications.find(n => {
return n.id === notification.id
})
- toBeUpdated = { ...toBeUpdated, ...notification }
- }
+ state.notifications = { ...toBeUpdated, ...notification }
+ },
}
export const getters = {
notifications(state) {
return !!state.notifications
- }
+ },
}
export const actions = {
@@ -36,7 +36,7 @@ export const actions = {
let notifications
try {
const {
- data: { currentUser }
+ data: { currentUser },
} = await client.query({
query: gql(`{
currentUser {
@@ -59,10 +59,9 @@ export const actions = {
}
}
}
- }`)
+ }`),
})
notifications = currentUser.notifications
- console.log(notifications)
commit('SET_NOTIFICATIONS', notifications)
} finally {
commit('SET_PENDING', false)
@@ -82,8 +81,8 @@ export const actions = {
`)
const variables = { id: notificationId, read: true }
const {
- data: { UpdateNotification }
+ data: { UpdateNotification },
} = await client.mutate({ mutation, variables })
commit('UPDATE_NOTIFICATIONS', UpdateNotification)
- }
+ },
}
diff --git a/webapp/store/search.js b/webapp/store/search.js
index 0f9c00440..4aeb5030d 100644
--- a/webapp/store/search.js
+++ b/webapp/store/search.js
@@ -5,7 +5,7 @@ export const state = () => {
return {
quickResults: [],
quickPending: false,
- quickValue: ''
+ quickValue: '',
}
}
@@ -19,7 +19,7 @@ export const mutations = {
},
SET_QUICK_VALUE(state, value) {
state.quickValue = value
- }
+ },
}
export const getters = {
@@ -31,7 +31,7 @@ export const getters = {
},
quickValue(state) {
return state.quickValue
- }
+ },
}
export const actions = {
@@ -64,8 +64,8 @@ export const actions = {
}
`),
variables: {
- filter: value.replace(/\s/g, '~ ') + '~'
- }
+ filter: value.replace(/\s/g, '~ ') + '~',
+ },
})
.then(res => {
commit('SET_QUICK_RESULTS', res.data.findPosts || [])
@@ -82,5 +82,5 @@ export const actions = {
commit('SET_QUICK_PENDING', false)
commit('SET_QUICK_RESULTS', [])
commit('SET_QUICK_VALUE', '')
- }
+ },
}
From ce3d16c146c161c20db9cfbb51b8ec3fbcabecb3 Mon Sep 17 00:00:00 2001
From: Ulf Gebhardt
Date: Thu, 23 May 2019 20:02:56 +0200
Subject: [PATCH 24/28] fixed test error caused by manual lint error fixing
---
webapp/components/Comment.spec.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/webapp/components/Comment.spec.js b/webapp/components/Comment.spec.js
index 6b5339ec2..ebb9b8bf8 100644
--- a/webapp/components/Comment.spec.js
+++ b/webapp/components/Comment.spec.js
@@ -65,6 +65,7 @@ describe('Comment.vue', () => {
})
it('translates a placeholder', () => {
+ /* const wrapper = */ Wrapper()
const calls = mocks.$t.mock.calls
const expected = [['comment.content.unavailable-placeholder']]
expect(calls).toEqual(expect.arrayContaining(expected))
From 73dd7d879f39b402cce94d99474d00d7cfb176fa Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Thu, 23 May 2019 18:24:57 +0000
Subject: [PATCH 25/28] Bump eslint-plugin-jest from 22.5.1 to 22.6.4 in
/backend
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 22.5.1 to 22.6.4.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v22.5.1...v22.6.4)
Signed-off-by: dependabot[bot]
---
backend/package.json | 2 +-
backend/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/backend/package.json b/backend/package.json
index 18a73d452..e57e63c42 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -98,7 +98,7 @@
"eslint-config-standard": "~12.0.0",
"eslint-config-prettier": "~4.3.0",
"eslint-plugin-import": "~2.17.2",
- "eslint-plugin-jest": "~22.5.1",
+ "eslint-plugin-jest": "~22.6.4",
"eslint-plugin-node": "~9.0.1",
"eslint-plugin-prettier": "~3.1.0",
"eslint-plugin-promise": "~4.1.1",
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 05393a9fe..7440f2bd2 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -3044,10 +3044,10 @@ eslint-plugin-import@~2.17.2:
read-pkg-up "^2.0.0"
resolve "^1.10.0"
-eslint-plugin-jest@~22.5.1:
- version "22.5.1"
- resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.5.1.tgz#a31dfe9f9513c6af7c17ece4c65535a1370f060b"
- integrity sha512-c3WjZR/HBoi4GedJRwo2OGHa8Pzo1EbSVwQ2HFzJ+4t2OoYM7Alx646EH/aaxZ+9eGcPiq0FT0UGkRuFFx2FHg==
+eslint-plugin-jest@~22.6.4:
+ version "22.6.4"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.6.4.tgz#2895b047dd82f90f43a58a25cf136220a21c9104"
+ integrity sha512-36OqnZR/uMCDxXGmTsqU4RwllR0IiB/XF8GW3ODmhsjiITKuI0GpgultWFt193ipN3HARkaIcKowpE6HBvRHNg==
eslint-plugin-node@~9.0.1:
version "9.0.1"
From 38346ee21df39189e6ec28620365c946dc1423f3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Fri, 24 May 2019 03:04:25 +0000
Subject: [PATCH 26/28] Bump @babel/preset-env from 7.4.4 to 7.4.5 in /backend
Bumps [@babel/preset-env](https://github.com/babel/babel) from 7.4.4 to 7.4.5.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.4.4...v7.4.5)
Signed-off-by: dependabot[bot]
---
backend/package.json | 2 +-
backend/yarn.lock | 131 +++++++++++++++++++++----------------------
2 files changed, 64 insertions(+), 69 deletions(-)
diff --git a/backend/package.json b/backend/package.json
index d4ce2b3e4..bfd35ee20 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -86,7 +86,7 @@
"@babel/core": "~7.4.5",
"@babel/node": "~7.2.2",
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
- "@babel/preset-env": "~7.4.4",
+ "@babel/preset-env": "~7.4.5",
"@babel/register": "~7.4.4",
"apollo-server-testing": "~2.5.0",
"babel-core": "~7.0.0-0",
diff --git a/backend/yarn.lock b/backend/yarn.lock
index d5580ee56..03baac615 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -524,12 +524,12 @@
"@babel/helper-module-transforms" "^7.1.0"
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-named-capturing-groups-regex@^7.4.4":
- version "7.4.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.4.tgz#5611d96d987dfc4a3a81c4383bb173361037d68d"
- integrity sha512-Ki+Y9nXBlKfhD+LXaRS7v95TtTGYRAf9Y1rTDiE75zf8YQz4GDaWRXosMfJBXxnk88mGFjWdCRIeqDbon7spYA==
+"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106"
+ integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg==
dependencies:
- regexp-tree "^0.1.0"
+ regexp-tree "^0.1.6"
"@babel/plugin-transform-new-target@^7.4.4":
version "7.4.4"
@@ -562,12 +562,12 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
-"@babel/plugin-transform-regenerator@^7.4.4":
- version "7.4.4"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.4.tgz#5b4da4df79391895fca9e28f99e87e22cfc02072"
- integrity sha512-Zz3w+pX1SI0KMIiqshFZkwnVGUhDZzpX2vtPzfJBKQQq8WsP/Xy9DNdELWivxcKOCX/Pywge4SiEaPaLtoDT4g==
+"@babel/plugin-transform-regenerator@^7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f"
+ integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA==
dependencies:
- regenerator-transform "^0.13.4"
+ regenerator-transform "^0.14.0"
"@babel/plugin-transform-reserved-words@^7.2.0":
version "7.2.0"
@@ -638,10 +638,10 @@
core-js "^2.5.7"
regenerator-runtime "^0.12.0"
-"@babel/preset-env@~7.4.4":
- version "7.4.4"
- resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.4.tgz#b6f6825bfb27b3e1394ca3de4f926482722c1d6f"
- integrity sha512-FU1H+ACWqZZqfw1x2G1tgtSSYSfxJLkpaUQL37CenULFARDo+h4xJoVHzRoHbK+85ViLciuI7ME4WTIhFRBBlw==
+"@babel/preset-env@~7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.5.tgz#2fad7f62983d5af563b5f3139242755884998a58"
+ integrity sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
@@ -672,12 +672,12 @@
"@babel/plugin-transform-modules-commonjs" "^7.4.4"
"@babel/plugin-transform-modules-systemjs" "^7.4.4"
"@babel/plugin-transform-modules-umd" "^7.2.0"
- "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.4"
+ "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5"
"@babel/plugin-transform-new-target" "^7.4.4"
"@babel/plugin-transform-object-super" "^7.2.0"
"@babel/plugin-transform-parameters" "^7.4.4"
"@babel/plugin-transform-property-literals" "^7.2.0"
- "@babel/plugin-transform-regenerator" "^7.4.4"
+ "@babel/plugin-transform-regenerator" "^7.4.5"
"@babel/plugin-transform-reserved-words" "^7.2.0"
"@babel/plugin-transform-shorthand-properties" "^7.2.0"
"@babel/plugin-transform-spread" "^7.2.0"
@@ -686,8 +686,8 @@
"@babel/plugin-transform-typeof-symbol" "^7.2.0"
"@babel/plugin-transform-unicode-regex" "^7.4.4"
"@babel/types" "^7.4.4"
- browserslist "^4.5.2"
- core-js-compat "^3.0.0"
+ browserslist "^4.6.0"
+ core-js-compat "^3.1.1"
invariant "^2.2.2"
js-levenshtein "^1.1.3"
semver "^5.5.0"
@@ -2036,14 +2036,14 @@ browser-resolve@^1.11.3:
dependencies:
resolve "1.1.7"
-browserslist@^4.5.1, browserslist@^4.5.2:
- version "4.5.4"
- resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.5.4.tgz#166c4ecef3b51737a42436ea8002aeea466ea2c7"
- integrity sha512-rAjx494LMjqKnMPhFkuLmLp8JWEX0o8ADTGeAbOqaF+XCvYLreZrG5uVjnPBlAQ8REZK4pzXGvp0bWgrFtKaag==
+browserslist@^4.6.0:
+ version "4.6.0"
+ resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.0.tgz#5274028c26f4d933d5b1323307c1d1da5084c9ff"
+ integrity sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg==
dependencies:
- caniuse-lite "^1.0.30000955"
- electron-to-chromium "^1.3.122"
- node-releases "^1.1.13"
+ caniuse-lite "^1.0.30000967"
+ electron-to-chromium "^1.3.133"
+ node-releases "^1.1.19"
bs58@=2.0.0:
version "2.0.0"
@@ -2134,10 +2134,10 @@ camelize@1.0.0:
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
-caniuse-lite@^1.0.30000955:
- version "1.0.30000956"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000956.tgz#fe56d8727fab96e0304ffbde6c4e538c9ad2a741"
- integrity sha512-3o7L6XkQ01Oney+x2fS5UVbQXJ7QQkYxrSfaLmFlgQabcKfploI8bhS2nmQ8Unh5MpMONAMeDEdEXG9t9AK6uA==
+caniuse-lite@^1.0.30000967:
+ version "1.0.30000971"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000971.tgz#d1000e4546486a6977756547352bc96a4cfd2b13"
+ integrity sha512-TQFYFhRS0O5rdsmSbF1Wn+16latXYsQJat66f7S7lizXW1PVpWJeZw9wqqVLIjuxDRz7s7xRUj13QCfd8hKn6g==
capture-exit@^1.2.0:
version "1.2.0"
@@ -2254,7 +2254,7 @@ cli-cursor@^2.1.0:
dependencies:
restore-cursor "^2.0.0"
-cli-table3@^0.5.0, cli-table3@^0.5.1:
+cli-table3@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.5.1.tgz#0252372d94dfc40dbd8df06005f48f31f656f202"
integrity sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==
@@ -2418,25 +2418,19 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
-core-js-compat@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.0.0.tgz#cd9810b8000742535a4a43773866185e310bd4f7"
- integrity sha512-W/Ppz34uUme3LmXWjMgFlYyGnbo1hd9JvA0LNQ4EmieqVjg2GPYbj3H6tcdP2QGPGWdRKUqZVbVKLNIFVs/HiA==
+core-js-compat@^3.1.1:
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.2.tgz#c29ab9722517094b98622175e2218c3b7398176d"
+ integrity sha512-X0Ch5f6itrHxhg5HSJucX6nNLNAGr+jq+biBh6nPGc3YAWz2a8p/ZIZY8cUkDzSRNG54omAuu3hoEF8qZbu/6Q==
dependencies:
- browserslist "^4.5.1"
- core-js "3.0.0"
- core-js-pure "3.0.0"
- semver "^5.6.0"
+ browserslist "^4.6.0"
+ core-js-pure "3.1.2"
+ semver "^6.0.0"
-core-js-pure@3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.0.0.tgz#a5679adb4875427c8c0488afc93e6f5b7125859b"
- integrity sha512-yPiS3fQd842RZDgo/TAKGgS0f3p2nxssF1H65DIZvZv0Od5CygP8puHXn3IQiM/39VAvgCbdaMQpresrbGgt9g==
-
-core-js@3.0.0, core-js@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957"
- integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ==
+core-js-pure@3.1.2:
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.2.tgz#62fc435f35b7374b9b782013cdcb2f97e9f6dffa"
+ integrity sha512-5ckIdBF26B3ldK9PM177y2ZcATP2oweam9RskHSoqfZCrJ2As6wVg8zJ1zTriFsZf6clj/N1ThDFRGaomMsh9w==
core-js@3.0.0-beta.13:
version "3.0.0-beta.13"
@@ -2448,6 +2442,11 @@ core-js@^2.4.0, core-js@^2.5.3, core-js@^2.5.7:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.2.tgz#267988d7268323b349e20b4588211655f0e83944"
integrity sha512-NdBPF/RVwPW6jr0NCILuyN9RiqLo2b1mddWHkUL+VnvcB7dzlnBJ1bXYntjpTGOgkZiiLWj2JxmOr7eGE3qK6g==
+core-js@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957"
+ integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ==
+
core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@@ -2869,10 +2868,10 @@ ee-first@1.1.1:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
-electron-to-chromium@^1.3.122:
- version "1.3.122"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.122.tgz#b32a0805f48557bd3c3b8104eadc7fa511b14a9a"
- integrity sha512-3RKoIyCN4DhP2dsmleuFvpJAIDOseWH88wFYBzb22CSwoFDSWRc4UAMfrtc9h8nBdJjTNIN3rogChgOy6eFInw==
+electron-to-chromium@^1.3.133:
+ version "1.3.137"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.137.tgz#ba7c88024984c038a5c5c434529aabcea7b42944"
+ integrity sha512-kGi32g42a8vS/WnYE7ELJyejRT7hbr3UeOOu0WeuYuQ29gCpg9Lrf6RdcTQVXSt/v0bjCfnlb/EWOOsiKpTmkw==
elliptic@=3.0.3:
version "3.0.3"
@@ -5690,10 +5689,10 @@ node-pre-gyp@^0.10.0:
semver "^5.3.0"
tar "^4"
-node-releases@^1.1.13:
- version "1.1.13"
- resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.13.tgz#8c03296b5ae60c08e2ff4f8f22ae45bd2f210083"
- integrity sha512-fKZGviSXR6YvVPyc011NHuJDSD8gFQvLPmc2d2V3BS4gr52ycyQ1Xzs7a8B+Ax3Ni/W+5h1h4SqmzeoA8WZRmA==
+node-releases@^1.1.19:
+ version "1.1.21"
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.21.tgz#46c86f9adaceae4d63c75d3c2f2e6eee618e55f3"
+ integrity sha512-TwnURTCjc8a+ElJUjmDqU6+12jhli1Q61xOQmdZ7ECZVBZuQpN/1UnembiIHDM1wCcfLvh5wrWXUF5H6ufX64Q==
dependencies:
semver "^5.3.0"
@@ -6546,10 +6545,10 @@ regenerator-runtime@^0.13.2:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447"
integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==
-regenerator-transform@^0.13.4:
- version "0.13.4"
- resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.4.tgz#18f6763cf1382c69c36df76c6ce122cc694284fb"
- integrity sha512-T0QMBjK3J0MtxjPmdIMXm72Wvj2Abb0Bd4HADdfijwMdoIsyQZ6fWC7kDFhk2YinBBEMZDL7Y7wh0J1sGx3S4A==
+regenerator-transform@^0.14.0:
+ version "0.14.0"
+ resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.0.tgz#2ca9aaf7a2c239dd32e4761218425b8c7a86ecaf"
+ integrity sha512-rtOelq4Cawlbmq9xuMR5gdFmv7ku/sFoB7sRiywx7aq53bc52b4j6zvH7Te1Vt/X2YveDKnCGUbioieU7FEL3w==
dependencies:
private "^0.1.6"
@@ -6561,14 +6560,10 @@ regex-not@^1.0.0, regex-not@^1.0.2:
extend-shallow "^3.0.2"
safe-regex "^1.1.0"
-regexp-tree@^0.1.0:
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.1.tgz#27b455f9b138ca2e84c090e9aff1ffe2a04d97fa"
- integrity sha512-HwRjOquc9QOwKTgbxvZTcddS5mlNlwePMQ3NFL8broajMLD5CXDAqas8Y5yxJH5QtZp5iRor3YCILd5pz71Cgw==
- dependencies:
- cli-table3 "^0.5.0"
- colors "^1.1.2"
- yargs "^12.0.5"
+regexp-tree@^0.1.6:
+ version "0.1.10"
+ resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc"
+ integrity sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ==
regexpp@^2.0.1:
version "2.0.1"
@@ -8097,7 +8092,7 @@ yargs-parser@^11.1.1:
camelcase "^5.0.0"
decamelize "^1.2.0"
-yargs@^12.0.2, yargs@^12.0.5:
+yargs@^12.0.2:
version "12.0.5"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13"
integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==
From 362425490040879eaa22543b3653213c231638e9 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Fri, 24 May 2019 03:04:26 +0000
Subject: [PATCH 27/28] Bump @babel/node from 7.2.2 to 7.4.5 in /backend
Bumps [@babel/node](https://github.com/babel/babel) from 7.2.2 to 7.4.5.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.2.2...v7.4.5)
Signed-off-by: dependabot[bot]
---
backend/package.json | 2 +-
backend/yarn.lock | 36 +++++++++++++++++++++---------------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/backend/package.json b/backend/package.json
index d4ce2b3e4..f812faed6 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -84,7 +84,7 @@
"devDependencies": {
"@babel/cli": "~7.4.4",
"@babel/core": "~7.4.5",
- "@babel/node": "~7.2.2",
+ "@babel/node": "~7.4.5",
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
"@babel/preset-env": "~7.4.4",
"@babel/register": "~7.4.4",
diff --git a/backend/yarn.lock b/backend/yarn.lock
index d5580ee56..f2b177ce1 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -278,15 +278,16 @@
esutils "^2.0.2"
js-tokens "^4.0.0"
-"@babel/node@~7.2.2":
- version "7.2.2"
- resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.2.2.tgz#1557dd23545b38d7b1d030a9c0e8fb225dbf70ab"
- integrity sha512-jPqgTycE26uFsuWpLika9Ohz9dmLQHWjOnMNxBOjYb1HXO+eLKxEr5FfKSXH/tBvFwwaw+pzke3gagnurGOfCA==
+"@babel/node@~7.4.5":
+ version "7.4.5"
+ resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.4.5.tgz#bce71bb44d902bfdd4da0b9c839a8a90fc084056"
+ integrity sha512-nDXPT0KwYMycDHhFG9wKlkipCR+iXzzoX9bD2aF2UABLhQ13AKhNi5Y61W8ASGPPll/7p9GrHesmlOgTUJVcfw==
dependencies:
"@babel/polyfill" "^7.0.0"
"@babel/register" "^7.0.0"
commander "^2.8.1"
- lodash "^4.17.10"
+ lodash "^4.17.11"
+ node-environment-flags "^1.0.5"
v8flags "^3.1.1"
"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.4", "@babel/parser@^7.4.5":
@@ -622,15 +623,7 @@
"@babel/helper-regex" "^7.4.4"
regexpu-core "^4.5.4"
-"@babel/polyfill@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.0.0.tgz#c8ff65c9ec3be6a1ba10113ebd40e8750fb90bff"
- integrity sha512-dnrMRkyyr74CRelJwvgnnSUDh2ge2NCTyHVwpOdvRMHtJUyxLtMAfhBN3s64pY41zdw0kgiLPh6S20eb1NcX6Q==
- dependencies:
- core-js "^2.5.7"
- regenerator-runtime "^0.11.1"
-
-"@babel/polyfill@^7.2.3":
+"@babel/polyfill@^7.0.0", "@babel/polyfill@^7.2.3":
version "7.2.5"
resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.2.5.tgz#6c54b964f71ad27edddc567d065e57e87ed7fa7d"
integrity sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug==
@@ -5639,6 +5632,14 @@ nocache@2.1.0:
resolved "https://registry.yarnpkg.com/nocache/-/nocache-2.1.0.tgz#120c9ffec43b5729b1d5de88cd71aa75a0ba491f"
integrity sha512-0L9FvHG3nfnnmaEQPjT9xhfN4ISk0A8/2j4M37Np4mcDesJjHgEUfgPhdCyZuFI954tjokaIj/A3NdpFNdEh4Q==
+node-environment-flags@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a"
+ integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==
+ dependencies:
+ object.getownpropertydescriptors "^2.0.3"
+ semver "^5.7.0"
+
node-fetch@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5"
@@ -6531,7 +6532,7 @@ regenerate@^1.4.0:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==
-regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1:
+regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
@@ -6857,6 +6858,11 @@ semver-diff@^2.0.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
+semver@^5.7.0:
+ version "5.7.0"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
+ integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
+
semver@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65"
From d842493d91dca757b374b4fd5fde1825e9ca4c30 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]"
Date: Fri, 24 May 2019 03:04:34 +0000
Subject: [PATCH 28/28] Bump apollo-client from 2.5.1 to 2.6.0 in /webapp
Bumps [apollo-client](https://github.com/apollographql/apollo-client) from 2.5.1 to 2.6.0.
- [Release notes](https://github.com/apollographql/apollo-client/releases)
- [Changelog](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/apollographql/apollo-client/compare/apollo-client@2.5.1...apollo-client@2.6.0)
Signed-off-by: dependabot[bot]
---
webapp/package.json | 2 +-
webapp/yarn.lock | 50 ++++++++++++++++++++++-----------------------
2 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/webapp/package.json b/webapp/package.json
index 616a8a5f0..4dfcb37f8 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -58,7 +58,7 @@
"@nuxtjs/style-resources": "~0.1.2",
"accounting": "~0.4.1",
"apollo-cache-inmemory": "~1.5.1",
- "apollo-client": "~2.5.1",
+ "apollo-client": "~2.6.0",
"cookie-universal-nuxt": "~2.0.14",
"cross-env": "~5.2.0",
"date-fns": "2.0.0-alpha.27",
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index 4e6ad32e7..5b576f707 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -1852,26 +1852,25 @@ apollo-cache-inmemory@^1.5.1, apollo-cache-inmemory@~1.5.1:
ts-invariant "^0.2.1"
tslib "^1.9.3"
-apollo-cache@1.2.1, apollo-cache@^1.2.1:
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.2.1.tgz#aae71eb4a11f1f7322adc343f84b1a39b0693644"
- integrity sha512-nzFmep/oKlbzUuDyz6fS6aYhRmfpcHWqNkkA9Bbxwk18RD6LXC4eZkuE0gXRX0IibVBHNjYVK+Szi0Yied4SpQ==
+apollo-cache@1.3.0, apollo-cache@^1.2.1:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.3.0.tgz#de5c907cbd329440c9b0aafcbe8436391b9e6142"
+ integrity sha512-voPlvSIDA2pY3+7QwtXPs7o5uSNAVjUKwimyHWoiW0MIZtPxawtOV/Y+BL85R227JqcjPic1El+QToVR8l4ytQ==
dependencies:
- apollo-utilities "^1.2.1"
+ apollo-utilities "^1.3.0"
tslib "^1.9.3"
-apollo-client@^2.5.1, apollo-client@~2.5.1:
- version "2.5.1"
- resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.5.1.tgz#36126ed1d32edd79c3713c6684546a3bea80e6d1"
- integrity sha512-MNcQKiqLHdGmNJ0rZ0NXaHrToXapJgS/5kPk0FygXt+/FmDCdzqcujI7OPxEC6e9Yw5S/8dIvOXcRNuOMElHkA==
+apollo-client@^2.5.1, apollo-client@~2.6.0:
+ version "2.6.0"
+ resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.0.tgz#9b66c04cd96d622cd72f92e584e7403c17532831"
+ integrity sha512-Z6oSD45vyw6maktMABXTaJliWdFJy4ihZGxbRh7rY65RWNz0HSm3IX66shLavdNqd4lpOcVuAufJl+w8u6RhLQ==
dependencies:
"@types/zen-observable" "^0.8.0"
- apollo-cache "1.2.1"
+ apollo-cache "1.3.0"
apollo-link "^1.0.0"
- apollo-link-dedup "^1.0.0"
- apollo-utilities "1.2.1"
+ apollo-utilities "1.3.0"
symbol-observable "^1.0.2"
- ts-invariant "^0.2.1"
+ ts-invariant "^0.4.0"
tslib "^1.9.3"
zen-observable "^0.8.0"
@@ -1927,14 +1926,6 @@ apollo-link-context@^1.0.17:
apollo-link "^1.2.11"
tslib "^1.9.3"
-apollo-link-dedup@^1.0.0:
- version "1.0.18"
- resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.18.tgz#635cb5659b082e7f270f7649c4b0f71021f7bb4b"
- integrity sha512-1rr54wyMTuqUmbWvcXbwduIcaCDcuIgU6MqQ599nAMuTrbSOXthGfoAD8BDTxBGQ9roVlM7ABP0VZVEWRoHWSg==
- dependencies:
- apollo-link "^1.2.11"
- tslib "^1.9.3"
-
apollo-link-http-common@^0.2.13:
version "0.2.13"
resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.13.tgz#c688f6baaffdc7b269b2db7ae89dae7c58b5b350"
@@ -2064,13 +2055,13 @@ apollo-upload-client@^10.0.0:
apollo-link-http-common "^0.2.13"
extract-files "^5.0.1"
-apollo-utilities@1.2.1, apollo-utilities@^1.0.1, apollo-utilities@^1.0.8, apollo-utilities@^1.2.1:
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.2.1.tgz#1c3a1ebf5607d7c8efe7636daaf58e7463b41b3c"
- integrity sha512-Zv8Udp9XTSFiN8oyXOjf6PMHepD4yxxReLsl6dPUy5Ths7jti3nmlBzZUOxuTWRwZn0MoclqL7RQ5UEJN8MAxg==
+apollo-utilities@1.3.0, apollo-utilities@^1.0.1, apollo-utilities@^1.0.8, apollo-utilities@^1.2.1, apollo-utilities@^1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.0.tgz#9803724c07ac94ca11dc26397edb58735d2b0211"
+ integrity sha512-wQjV+FdWcTWmWUFlChG5rS0vHKy5OsXC6XlV9STRstQq6VbXANwHy6DHnTEQAfLXWAbNcPgBu+nBUpR3dFhwrA==
dependencies:
fast-json-stable-stringify "^2.0.0"
- ts-invariant "^0.2.1"
+ ts-invariant "^0.4.0"
tslib "^1.9.3"
aproba@^1.0.3, aproba@^1.1.1:
@@ -10662,6 +10653,13 @@ ts-invariant@^0.3.2:
dependencies:
tslib "^1.9.3"
+ts-invariant@^0.4.0:
+ version "0.4.2"
+ resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.2.tgz#8685131b8083e67c66d602540e78763408be9113"
+ integrity sha512-PTAAn8lJPEdRBJJEs4ig6MVZWfO12yrFzV7YaPslmyhG7+4MA279y4BXT3f72gXeVl0mC1aAWq2rMX4eKTWU/Q==
+ dependencies:
+ tslib "^1.9.3"
+
ts-node@^8.0.3:
version "8.1.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.1.0.tgz#8c4b37036abd448577db22a061fd7a67d47e658e"