From 97a374fd8453213a71b56f211d09b3d389c304a5 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Tue, 28 May 2019 12:46:52 -0300 Subject: [PATCH 1/8] Fix placeholder text not translating bug - tiptap-extensions are not reactive - we must call a method to change them dynamically - emit changeLanguage event, which is listened for by the Editor component, which then calls a method to set the emptyNodeText of tiptap --- webapp/components/Editor/index.vue | 8 ++++++++ webapp/components/LocaleSwitch.vue | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/webapp/components/Editor/index.vue b/webapp/components/Editor/index.vue index ac1391a42..ca6ee4779 100644 --- a/webapp/components/Editor/index.vue +++ b/webapp/components/Editor/index.vue @@ -327,10 +327,18 @@ export default { }, }, }, + mounted() { + this.$root.$on('changeLanguage', () => { + this.changePlaceHolderText() + }) + }, beforeDestroy() { this.editor.destroy() }, methods: { + changePlaceHolderText() { + this.editor.extensions.options.placeholder.emptyNodeText = this.$t('editor.placeholder') + }, // navigate to the previous item // if it's the first item, navigate to the last one upHandler() { diff --git a/webapp/components/LocaleSwitch.vue b/webapp/components/LocaleSwitch.vue index a00f38109..840990c19 100644 --- a/webapp/components/LocaleSwitch.vue +++ b/webapp/components/LocaleSwitch.vue @@ -14,7 +14,8 @@ {{ current.code.toUpperCase() }} + /> + {{ current.code.toUpperCase() }} Date: Tue, 28 May 2019 18:27:52 +0200 Subject: [PATCH 2/8] Run coverage only if requested I find it annoying to wait for code coverage tools to complete (~3 seconds) and especially to scroll up for every test run. So, this should run coverage only on our build server *or* if you add `--coverage` on the command line. --- .travis.yml | 4 ++-- backend/package.json | 1 - webapp/package.json | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d9a4c733..6ba9d7f12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ install: script: # Backend - docker-compose exec backend yarn run lint - - docker-compose exec backend yarn run test:jest --ci --verbose=false + - docker-compose exec backend yarn run test:jest --ci --verbose=false --coverage - docker-compose exec backend yarn run db:reset - docker-compose exec backend yarn run db:seed - docker-compose exec backend yarn run test:cucumber @@ -30,7 +30,7 @@ script: - docker-compose exec backend yarn run db:seed # Frontend - docker-compose exec webapp yarn run lint - - docker-compose exec webapp yarn run test --ci --verbose=false + - docker-compose exec webapp yarn run test --ci --verbose=false --coverage - docker-compose exec -d backend yarn run test:before:seeder # Fullstack - CYPRESS_RETRIES=1 yarn run cypress:run diff --git a/backend/package.json b/backend/package.json index 75258b36b..9f2bbe7ab 100644 --- a/backend/package.json +++ b/backend/package.json @@ -26,7 +26,6 @@ "license": "MIT", "jest": { "verbose": true, - "collectCoverage": true, "collectCoverageFrom": [ "**/*.js", "!**/node_modules/**", diff --git a/webapp/package.json b/webapp/package.json index 29714e513..b73b5cb3b 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -22,7 +22,6 @@ }, "jest": { "verbose": true, - "collectCoverage": true, "collectCoverageFrom": [ "**/*.{js,vue}", "!**/node_modules/**", From 014104e0556dc23c638a619647ffdd89cfedbf3b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 28 May 2019 18:53:05 +0200 Subject: [PATCH 3/8] fixed data import from alpha data: - include all collections (commented out) - refactored neo4j import script - use of .env file for (additional) configurations / configuration overrides - lots of fiddeling with neo4j cql files and cypher shell --- .../maintenance-worker/migration/neo4j/.env | 16 ++++++ .../migration/neo4j/badges.cql | 2 +- .../migration/neo4j/import.sh | 51 +++++++++++++++---- 3 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 deployment/legacy-migration/maintenance-worker/migration/neo4j/.env diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/.env b/deployment/legacy-migration/maintenance-worker/migration/neo4j/.env new file mode 100644 index 000000000..7691306ac --- /dev/null +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/.env @@ -0,0 +1,16 @@ +# Neo4J Settings +# NEO4J_USERNAME='neo4j' +# NEO4J_PASSWORD='letmein' + +# Import Settings +# On Windows this resolves to C:\Users\dornhoeschen\AppData\Local\Temp\mongo-export (MinGW) +IMPORT_PATH='/tmp/mongo-export/' +IMPORT_CHUNK_PATH='/tmp/mongo-export/splits/current-chunk.json' + +IMPORT_CHUNK_PATH_CQL='/tmp/mongo-export/splits/current-chunk.json' +# On Windows this path needs to be windows style since the cypher-shell runs native - note the forward slash +# IMPORT_CHUNK_PATH_CQL='C:/Users/dornhoeschen/AppData/Local/Temp/mongo-export/splits/current-chunk.json' + +IMPORT_CYPHERSHELL_BIN='cypher-shell' +# On Windows use something like this +# IMPORT_CYPHERSHELL_BIN='C:\Program Files\neo4j-community\bin\cypher-shell.bat' \ No newline at end of file diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql index 6b6a09592..62eddf124 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as badge +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as badge MERGE(b:Badge {id: badge._id["$oid"]}) ON CREATE SET b.key = badge.key, diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh index b7de74782..9e0189166 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh @@ -1,17 +1,48 @@ #!/usr/bin/env bash set -e -SECONDS=0 -SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +# import .env config +set -o allexport +source $(dirname "$0")/.env +set +o allexport -echo "MATCH (n) DETACH DELETE n;" | cypher-shell - -for collection in "badges" "categories" "users" "follows" "contributions" "shouts" "comments" -do - for chunk in /tmp/mongo-export/splits/$collection/* +# Import collection function defintion +function import_collection () { + for chunk in ${IMPORT_PATH}splits/$1/* do - mv $chunk /tmp/mongo-export/splits/current-chunk.json - echo "Import ${chunk}" && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql + mv $chunk ${IMPORT_CHUNK_PATH} + NEO4J_COMMAND="$(envsubst '${IMPORT_CHUNK_PATH_CQL}' < $(dirname "$0")/$1.cql)" + echo "Import ${chunk}" + echo "${NEO4J_COMMAND}" | "${IMPORT_CYPHERSHELL_BIN}" -u ${NEO4J_USERNAME} -p ${NEO4J_PASSWORD} done -done +} + +# Time variable +SECONDS=0 + +# Delete all Neo4J Database content +echo "Deleting Database Contents" +echo "MATCH (n) DETACH DELETE n;" | "${IMPORT_CYPHERSHELL_BIN}" -u ${NEO4J_USERNAME} -p ${NEO4J_PASSWORD} + +# Import Data +echo "Start Importing Data" +import_collection "badges" +#import_collection "categories" +#import_collection "comments" +#import_collection "contributions" +#import_collection "emotions" +#import_collection "follows" +#import_collection "invites" +#import_collection "notifications" +#import_collection "organizations" +#import_collection "pages" +#import_collection "projects" +#import_collection "settings" +#import_collection "shouts" +#import_collection "status" +#import_collection "systemnotifications" +#import_collection "users" +#import_collection "userscandos" +#import_collection "usersettings" + echo "Time elapsed: $SECONDS seconds" From ab7a4ffc3eb1bf9750f8876a32f29770f6f552eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Thu, 23 May 2019 15:58:39 +0200 Subject: [PATCH 4/8] Fix duplicate tags by using the name as the id @ulfgebhardt: I wondered about the list of tags after importing the legacy db. It seems, each tag has at most 1 contribution. I guess it's because we create a unique id for each tag, so two tags with the same `name` e.g. `#hashtag` and `#hashtag` are not de-duplicated. I'm currently sitting in the train and cannot run the data import myself, could you double-check? --- .../maintenance-worker/migration/neo4j/contributions.cql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql index 01647f7fb..194ba39fd 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql @@ -20,6 +20,6 @@ MATCH (c:Category {id: categoryId}) MERGE (p)-[:CATEGORIZED]->(c) WITH p, post.tags AS tags UNWIND tags AS tag -MERGE (t:Tag {id: apoc.create.uuid(), name: tag}) +MERGE (t:Tag {id: tag, name: tag}) MERGE (p)-[:TAGGED]->(t) ; From 4ccfe3822c7755fbdb5541dec251bd422462919b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 29 May 2019 00:20:43 +0200 Subject: [PATCH 5/8] added existing data imports --- .../migration/neo4j/categories.cql | 2 +- .../maintenance-worker/migration/neo4j/comments.cql | 2 +- .../migration/neo4j/contributions.cql | 2 +- .../maintenance-worker/migration/neo4j/follows.cql | 2 +- .../maintenance-worker/migration/neo4j/import.sh | 12 ++++++------ .../maintenance-worker/migration/neo4j/shouts.cql | 2 +- .../maintenance-worker/migration/neo4j/users.cql | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql index 776811bec..81e73c1b9 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as category +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as category MERGE(c:Category {id: category._id["$oid"]}) ON CREATE SET c.name = category.title, diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql index 234d29d26..1c8eb9397 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as json +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as json MERGE (comment:Comment {id: json._id["$oid"]}) ON CREATE SET diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql index 01647f7fb..e60f053b8 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as post +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as post MERGE (p:Post {id: post._id["$oid"]}) ON CREATE SET p.title = post.title, diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql index 0cd6d9cfc..bf3837b04 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as follow +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as follow MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId}) MERGE (u1)-[:FOLLOWS]->(u2) ; diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh index 9e0189166..12cc7ce67 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh @@ -27,21 +27,21 @@ echo "MATCH (n) DETACH DELETE n;" | "${IMPORT_CYPHERSHELL_BIN}" -u ${NEO4J_USERN # Import Data echo "Start Importing Data" import_collection "badges" -#import_collection "categories" -#import_collection "comments" -#import_collection "contributions" +import_collection "categories" +import_collection "users" +import_collection "follows" +import_collection "contributions" +import_collection "shouts" +import_collection "comments" #import_collection "emotions" -#import_collection "follows" #import_collection "invites" #import_collection "notifications" #import_collection "organizations" #import_collection "pages" #import_collection "projects" #import_collection "settings" -#import_collection "shouts" #import_collection "status" #import_collection "systemnotifications" -#import_collection "users" #import_collection "userscandos" #import_collection "usersettings" diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql index 5019cdc32..a82a7a33d 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as shout +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as shout MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId}) MERGE (u)-[:SHOUTED]->(p) ; diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql index c877f8377..693fd75b6 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql @@ -1,4 +1,4 @@ -CALL apoc.load.json('file:/tmp/mongo-export/splits/current-chunk.json') YIELD value as user +CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL}") YIELD value as user MERGE(u:User {id: user._id["$oid"]}) ON CREATE SET u.name = user.name, From b08b29ba8e48c13e618d2d13828a2c66cbf260b6 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Tue, 28 May 2019 20:35:47 -0300 Subject: [PATCH 6/8] Fix user avatar jumping on upload --- webapp/components/Upload/index.vue | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/webapp/components/Upload/index.vue b/webapp/components/Upload/index.vue index 831edd2f8..f43ede7e6 100644 --- a/webapp/components/Upload/index.vue +++ b/webapp/components/Upload/index.vue @@ -48,13 +48,6 @@ export default {
-
-
-
-
-
-
- ` }, @@ -117,15 +110,16 @@ export default { } #customdropzone .dz-preview { + transition: all 0.2s ease-out; width: 160px; display: flex; } #customdropzone .dz-preview .dz-image { - position: relative; - width: 122px; - height: 122px; - margin: -35px; + width: 100%; + height: 100%; + object-fit: contain; + overflow: hidden; } #customdropzone .dz-preview .dz-image > div { From 0003a98fd2456d6c6db50a719b5147b90693570c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 27 May 2019 22:19:59 +0000 Subject: [PATCH 7/8] Bump prettier from 1.14.3 to 1.17.1 in /backend Bumps [prettier](https://github.com/prettier/prettier) from 1.14.3 to 1.17.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/1.14.3...1.17.1) 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 9f2bbe7ab..71c050461 100644 --- a/backend/package.json +++ b/backend/package.json @@ -105,7 +105,7 @@ "graphql-request": "~1.8.2", "jest": "~24.8.0", "nodemon": "~1.19.1", - "prettier": "~1.14.3", + "prettier": "~1.17.1", "supertest": "~4.0.2" } } diff --git a/backend/yarn.lock b/backend/yarn.lock index 176af3893..50415cf09 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -6233,10 +6233,10 @@ 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== +prettier@~1.17.1: + version "1.17.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db" + integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg== pretty-format@^24.8.0: version "24.8.0" From ffd584ded1ddc863b0c5a692ce5fc4bd0538f404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 29 May 2019 12:36:26 +0200 Subject: [PATCH 8/8] Fix prettier --- backend/src/middleware/permissionsMiddleware.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index 2e7a2cd1a..b1a08a14d 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -1,9 +1,9 @@ import { rule, shield, allow, or } from 'graphql-shield' /* -* TODO: implement -* See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363 -*/ + * TODO: implement + * See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363 + */ const isAuthenticated = rule()(async (parent, args, ctx, info) => { return ctx.user !== null })