From 8f7ec2efe68fca0e82191e8ddb176b0d684f6295 Mon Sep 17 00:00:00 2001 From: molda Date: Sun, 4 Aug 2019 19:34:25 +0300 Subject: [PATCH 01/18] added vue-infinite-scroll plugin --- webapp/nuxt.config.js | 1 + webapp/package.json | 1 + webapp/plugins/vue-infinite-scroll.js | 4 ++++ webapp/yarn.lock | 6 +++++- 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 webapp/plugins/vue-infinite-scroll.js diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index 3c25e43b6..c7d6d1a27 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -100,6 +100,7 @@ module.exports = { { src: '~/plugins/v-tooltip.js', ssr: false }, { src: '~/plugins/izi-toast.js', ssr: false }, { src: '~/plugins/vue-filters.js' }, + { src: '~/plugins/vue-infinite-scroll.js', ssr: false }, ], router: { diff --git a/webapp/package.json b/webapp/package.json index f3fa36012..ed53480f0 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -76,6 +76,7 @@ "tiptap-extensions": "~1.26.2", "v-tooltip": "~2.0.2", "vue-count-to": "~1.0.13", + "vue-infinite-scroll": "^2.0.2", "vue-izitoast": "roschaefer/vue-izitoast#patch-1", "vuex-i18n": "~1.13.1", "vue-sweetalert-icons": "~4.2.0", diff --git a/webapp/plugins/vue-infinite-scroll.js b/webapp/plugins/vue-infinite-scroll.js new file mode 100644 index 000000000..3d6891e9c --- /dev/null +++ b/webapp/plugins/vue-infinite-scroll.js @@ -0,0 +1,4 @@ +import Vue from 'vue' +import infiniteScroll from 'vue-infinite-scroll' + +Vue.use(infiniteScroll) diff --git a/webapp/yarn.lock b/webapp/yarn.lock index b27a0951f..54e2d8430 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -14887,9 +14887,13 @@ vue-hot-reload-api@^2.3.0: resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz#2756f46cb3258054c5f4723de8ae7e87302a1ccf" integrity sha512-KmvZVtmM26BQOMK1rwUZsrqxEGeKiYSZGA7SNWE6uExx8UX/cj9hq2MRV/wWC3Cq6AoeDGk57rL9YMFRel/q+g== +vue-infinite-scroll@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/vue-infinite-scroll/-/vue-infinite-scroll-2.0.2.tgz#ca37a91fe92ee0ad3b74acf8682c00917144b711" + integrity sha512-n+YghR059YmciANGJh9SsNWRi1YZEBVlODtmnb/12zI+4R72QZSWd+EuZ5mW6auEo/yaJXgxzwsuhvALVnm73A== + vue-izitoast@roschaefer/vue-izitoast#patch-1: version "1.1.2" - uid ba6b03eb24c7c04c299e64a9703e101bf158ae50 resolved "https://codeload.github.com/roschaefer/vue-izitoast/tar.gz/ba6b03eb24c7c04c299e64a9703e101bf158ae50" dependencies: izitoast "^1.3.0" From 2edf26ac0a1fa25f25df9bff4be080478282df01 Mon Sep 17 00:00:00 2001 From: molda Date: Sun, 4 Aug 2019 19:34:44 +0300 Subject: [PATCH 02/18] implemented infinite-scroll to index page --- webapp/pages/index.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index 683e5eb65..768a71e3b 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -33,7 +33,14 @@ primary /> - +
+ +
From 7cd3b0d5242d4066c954991ec79d564298e259c9 Mon Sep 17 00:00:00 2001 From: molda Date: Sun, 4 Aug 2019 19:39:36 +0300 Subject: [PATCH 03/18] implemented infinite-scroll in profile page --- webapp/pages/profile/_id/_slug.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 0e15218c8..540e6bdc8 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -229,7 +229,14 @@ - +
+ +
From f5c939472b32acec0bd284e76a74537ec298bee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Tue, 6 Aug 2019 01:36:08 +0200 Subject: [PATCH 04/18] Fix console.errors in frontend tests @MoldaB here's how you can register plugins in a frontend test. Pro tip: You can run `yarn run test --run-in-band` to find out where the console.errors come from. Jest, by default, runs in parallel which makes it a little difficult to debug errors that don't fail the test. --- webapp/pages/index.spec.js | 2 ++ webapp/pages/profile/_id/_slug.spec.js | 2 ++ webapp/plugins/vue-infinite-scroll.js | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/webapp/pages/index.spec.js b/webapp/pages/index.spec.js index 805640ef6..6dacd6069 100644 --- a/webapp/pages/index.spec.js +++ b/webapp/pages/index.spec.js @@ -5,6 +5,7 @@ import Styleguide from '@human-connection/styleguide' import Filters from '~/plugins/vue-filters' import VTooltip from 'v-tooltip' import FilterMenu from '~/components/FilterMenu/FilterMenu' +import InfiniteScroll from '~/plugins/vue-infinite-scroll' const localVue = createLocalVue() @@ -12,6 +13,7 @@ localVue.use(Vuex) localVue.use(Styleguide) localVue.use(Filters) localVue.use(VTooltip) +localVue.use(InfiniteScroll) config.stubs['no-ssr'] = '' config.stubs['router-link'] = '' diff --git a/webapp/pages/profile/_id/_slug.spec.js b/webapp/pages/profile/_id/_slug.spec.js index bd6c9c598..59dfddc8b 100644 --- a/webapp/pages/profile/_id/_slug.spec.js +++ b/webapp/pages/profile/_id/_slug.spec.js @@ -3,12 +3,14 @@ import ProfileSlug from './_slug.vue' import Vuex from 'vuex' import Styleguide from '@human-connection/styleguide' import Filters from '~/plugins/vue-filters' +import InfiniteScroll from '~/plugins/vue-infinite-scroll' const localVue = createLocalVue() localVue.use(Vuex) localVue.use(Styleguide) localVue.use(Filters) +localVue.use(InfiniteScroll) localVue.filter('date', d => d) config.stubs['no-ssr'] = '' diff --git a/webapp/plugins/vue-infinite-scroll.js b/webapp/plugins/vue-infinite-scroll.js index 3d6891e9c..776db193b 100644 --- a/webapp/plugins/vue-infinite-scroll.js +++ b/webapp/plugins/vue-infinite-scroll.js @@ -1,4 +1,4 @@ -import Vue from 'vue' -import infiniteScroll from 'vue-infinite-scroll' - -Vue.use(infiniteScroll) +import Vue from 'vue' +import infiniteScroll from 'vue-infinite-scroll' + +Vue.use(infiniteScroll) From a052743e8b28e7eba3cc6f2a71fc77aa1eaa2196 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 15 Aug 2019 11:39:09 +0200 Subject: [PATCH 05/18] Bind infinite-scroll-* correctly --- webapp/pages/index.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index 768a71e3b..12e4ce108 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -36,8 +36,9 @@
From 67bd1184aa06f414b2ab2afc2ec1380b5dd17175 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 15 Aug 2019 17:09:08 +0200 Subject: [PATCH 06/18] Fine tune throttle delay --- webapp/pages/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index 12e4ce108..7566ce791 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -39,6 +39,7 @@ :infinite-scroll-immediate-check="true" :infinite-scroll-disabled="$apollo.loading" :infinite-scroll-distance="10" + :infinite-scroll-throttle-delay="800" > From 8305c69def3eb32fc47912a0dd3c3c905aa2d477 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2019 15:43:57 +0000 Subject: [PATCH 07/18] Bump @human-connection/styleguide from 0.5.17 to 0.5.18 in /webapp Bumps @human-connection/styleguide from 0.5.17 to 0.5.18. Signed-off-by: dependabot-preview[bot] --- webapp/package.json | 2 +- webapp/yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index f3fa36012..87ad3f92c 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -50,7 +50,7 @@ ] }, "dependencies": { - "@human-connection/styleguide": "0.5.17", + "@human-connection/styleguide": "0.5.18", "@nuxtjs/apollo": "^4.0.0-rc10", "@nuxtjs/axios": "~5.5.4", "@nuxtjs/dotenv": "~1.4.0", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index b27a0951f..c7f2ba1fb 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -966,12 +966,12 @@ supports-color "^5.5.0" tslib "^1.9.3" -"@human-connection/styleguide@0.5.17": - version "0.5.17" - resolved "https://registry.yarnpkg.com/@human-connection/styleguide/-/styleguide-0.5.17.tgz#99816579616c8d5be6c66ee86c39cb6c4e694878" - integrity sha512-Qlo29eOi97lHls40Ms1hbGC29Aoz/W6BLoX/no5TQgHlP4qm+OK7Ra75g0sbj3a2x1Q4mZthUDWcqtjTYf6brw== +"@human-connection/styleguide@0.5.18": + version "0.5.18" + resolved "https://registry.yarnpkg.com/@human-connection/styleguide/-/styleguide-0.5.18.tgz#1e869fa198c44f5f164e78a79c196b80c0647d97" + integrity sha512-nRx6tk6tzMMibKDMaxbcRQfm8IX3FIjhrCa2rSojAN4rE0Iyefrr9kNNPo7QpjDI45IXn+zH+x9PhdJtByBQAg== dependencies: - vue "^2.6.6" + vue "^2.6.10" "@jest/console@^24.7.1": version "24.7.1" @@ -15015,7 +15015,7 @@ vue2-dropzone@3.5.8: dependencies: dropzone "^5.5.1" -vue@^2.6.10, vue@^2.6.6: +vue@^2.6.10: version "2.6.10" resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== From d3b256e99eee18134ce564a22882bf31cf0915aa Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 15 Aug 2019 21:07:23 +0200 Subject: [PATCH 08/18] Fix user mention menu on production data Apparently some of our users in production have no slug, this will assign an (hopefully unique) random slug to them. --- .../maintenance-worker/migration/neo4j/users/users.cql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql index a1045bdeb..02dff089f 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql @@ -94,12 +94,11 @@ } } */ - CALL apoc.load.json("file:${IMPORT_CHUNK_PATH_CQL_FILE}") YIELD value as user MERGE(u:User {id: user._id["$oid"]}) ON CREATE SET u.name = user.name, -u.slug = user.slug, +u.slug = COALESCE(user.slug, apoc.text.random(20, "[A-Za-z]")), u.email = user.email, u.encryptedPassword = user.password, u.avatar = replace(user.avatar, 'https://api-alpha.human-connection.org', ''), From 22f79d6e0b24f56a24eacfdb97785452e6d304be Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2019 20:00:09 +0000 Subject: [PATCH 09/18] Bump @human-connection/styleguide from 0.5.18 to 0.5.19 in /webapp Bumps @human-connection/styleguide from 0.5.18 to 0.5.19. Signed-off-by: dependabot-preview[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 87ad3f92c..99004a232 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -50,7 +50,7 @@ ] }, "dependencies": { - "@human-connection/styleguide": "0.5.18", + "@human-connection/styleguide": "0.5.19", "@nuxtjs/apollo": "^4.0.0-rc10", "@nuxtjs/axios": "~5.5.4", "@nuxtjs/dotenv": "~1.4.0", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index c7f2ba1fb..da034444f 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -966,10 +966,10 @@ supports-color "^5.5.0" tslib "^1.9.3" -"@human-connection/styleguide@0.5.18": - version "0.5.18" - resolved "https://registry.yarnpkg.com/@human-connection/styleguide/-/styleguide-0.5.18.tgz#1e869fa198c44f5f164e78a79c196b80c0647d97" - integrity sha512-nRx6tk6tzMMibKDMaxbcRQfm8IX3FIjhrCa2rSojAN4rE0Iyefrr9kNNPo7QpjDI45IXn+zH+x9PhdJtByBQAg== +"@human-connection/styleguide@0.5.19": + version "0.5.19" + resolved "https://registry.yarnpkg.com/@human-connection/styleguide/-/styleguide-0.5.19.tgz#ab5df5e421bb8e8259747c0f48b1f324ad013c43" + integrity sha512-UrmHtIvJ+bi0s4Q2Xjh0lIcBYcGiiOeIp34XT16CO4Oe/ziZZ/bFph5kTgrYtrIz42qucmNHZ8TxN5gYRD1MoQ== dependencies: vue "^2.6.10" From 3d4724e314711298cd72ebe0adfc38695fb1d570 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Fri, 16 Aug 2019 00:19:26 +0200 Subject: [PATCH 10/18] Fix `Cannot read property countUser of null` This commit message is a great example of why you should explain **the reason** of your commit. When I came across this bug I had a quick look into the code where it came from. I could see that the bug only happened after a timer and apparently reverting the biggest part of d84892930295dcfd3f6687fc33c7234446127099 would fix the bug. However I have no idea what the following commit message means: ``` commit d84892930295dcfd3f6687fc33c7234446127099 Author: Grzegorz Leoniec Date: Wed Mar 6 18:45:57 2019 +0100 Improved countTo component ``` I just don't know why the code is there - like what is it's purpose @appinteractive? I can only guess: I believe that it's supposed to update the counters in-place (without starting from 0 everytime). Because apollo was set to poll the data every second. Taking that into account I would rather remove this polling feature completely and have less code and less complexity. Admins can still refresh the page. --- webapp/components/CountTo.vue | 20 +------------------- webapp/pages/admin/index.vue | 21 +++++++++------------ 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/webapp/components/CountTo.vue b/webapp/components/CountTo.vue index ee0e3e082..65ad84b56 100644 --- a/webapp/components/CountTo.vue +++ b/webapp/components/CountTo.vue @@ -2,7 +2,7 @@ { - this.isReady = true - }, 500) - }, } diff --git a/webapp/pages/admin/index.vue b/webapp/pages/admin/index.vue index 7790ed849..39dd4800e 100644 --- a/webapp/pages/admin/index.vue +++ b/webapp/pages/admin/index.vue @@ -7,7 +7,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -30,7 +30,7 @@ uppercase > - + @@ -44,7 +44,7 @@ uppercase > - + @@ -58,7 +58,7 @@ uppercase > - + @@ -72,7 +72,7 @@ uppercase > - + @@ -81,7 +81,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -99,7 +99,7 @@ - + @@ -128,9 +128,6 @@ export default { return process.client }, }, - mounted() { - this.$apollo.queries.statistics.startPolling(5000) - }, apollo: { statistics: { query: gql` From bb4b3196a7b2069a19410316aeeeb39b48fefd85 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 15 Aug 2019 23:04:14 +0200 Subject: [PATCH 11/18] Fix various issues in legacy db import Most important: Remove `#` symbol from Tags and snakeCase them. --- .../maintenance-worker/migration/mongo/export.sh | 2 -- .../migration/neo4j/contributions/contributions.cql | 2 +- .../maintenance-worker/migration/neo4j/users/delete.cql | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh b/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh index 8d16f42fa..f80ea8b8b 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh @@ -38,14 +38,12 @@ export_collection "emotions" export_collection_query "follows" "{'foreignService': 'organizations'}" "organizations" export_collection_query "follows" "{'foreignService': 'users'}" "users" export_collection "invites" -export_collection "notifications" export_collection "organizations" export_collection "pages" export_collection "projects" export_collection "settings" export_collection "shouts" export_collection "status" -export_collection "systemnotifications" export_collection "users" export_collection "userscandos" export_collection "usersettings" diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql index a0f1418aa..af81528f2 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql @@ -148,6 +148,6 @@ MATCH (c:Category {id: categoryId}) MERGE (p)-[:CATEGORIZED]->(c) WITH p, post.tags AS tags UNWIND tags AS tag -MERGE (t:Tag {id: tag, name: tag}) +MERGE (t:Tag {id: apoc.text.clean(tag), disabled: false, deleted: false}) MERGE (p)-[:TAGGED]->(t) ; diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql index 23935b3e0..32679f6c8 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql @@ -1 +1,2 @@ -MATCH (n:User) DETACH DELETE n; \ No newline at end of file +MATCH (n:User) DETACH DELETE n; +MATCH (e:EmailAddress) DETACH DELETE e; From 51b734275a12c5c57d916ecceda7271b9b2a5df2 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Fri, 16 Aug 2019 00:18:10 +0200 Subject: [PATCH 12/18] The name of the hashtag is now it's ID `name` was just a redundant attribute --- .../handleContentData.spec.js | 11 ++-------- backend/src/schema/types/type/Tag.gql | 1 - backend/src/seed/factories/tags.js | 6 ++--- cypress/integration/common/steps.js | 22 +++++++++---------- neo4j/db_setup.sh | 1 - .../ContributionForm/ContributionForm.vue | 3 +-- webapp/components/Editor/Editor.vue | 18 ++++++--------- webapp/components/Tag/index.vue | 4 ++-- webapp/components/Tag/spec.js | 6 ++--- webapp/graphql/PostQuery.js | 2 +- webapp/pages/admin/tags.vue | 11 +++++----- webapp/pages/post/_id/_slug/index.vue | 2 +- 12 files changed, 36 insertions(+), 51 deletions(-) diff --git a/backend/src/middleware/handleHtmlContent/handleContentData.spec.js b/backend/src/middleware/handleHtmlContent/handleContentData.spec.js index 40d8a2481..fb088e428 100644 --- a/backend/src/middleware/handleHtmlContent/handleContentData.spec.js +++ b/backend/src/middleware/handleHtmlContent/handleContentData.spec.js @@ -198,7 +198,6 @@ describe('Hashtags', () => { Post(id: $id) { tags { id - name } } } @@ -234,10 +233,7 @@ describe('Hashtags', () => { }) it('both Hashtags are created with the "id" set to their "name"', async () => { - const expected = [ - { id: 'Democracy', name: 'Democracy' }, - { id: 'Liberty', name: 'Liberty' }, - ] + const expected = [{ id: 'Democracy' }, { id: 'Liberty' }] await expect( query({ query: postWithHastagsQuery, variables: postWithHastagsVariables }), ).resolves.toEqual( @@ -277,10 +273,7 @@ describe('Hashtags', () => { }, }) - const expected = [ - { id: 'Elections', name: 'Elections' }, - { id: 'Liberty', name: 'Liberty' }, - ] + const expected = [{ id: 'Elections' }, { id: 'Liberty' }] await expect( query({ query: postWithHastagsQuery, variables: postWithHastagsVariables }), ).resolves.toEqual( diff --git a/backend/src/schema/types/type/Tag.gql b/backend/src/schema/types/type/Tag.gql index 47021bf82..c9c36343a 100644 --- a/backend/src/schema/types/type/Tag.gql +++ b/backend/src/schema/types/type/Tag.gql @@ -1,6 +1,5 @@ type Tag { id: ID! - name: String! taggedPosts: [Post]! @relation(name: "TAGGED", direction: "IN") taggedOrganizations: [Organization]! @relation(name: "TAGGED", direction: "IN") taggedCount: Int! @cypher(statement: "MATCH (this)<-[:TAGGED]-(p) RETURN COUNT(DISTINCT p)") diff --git a/backend/src/seed/factories/tags.js b/backend/src/seed/factories/tags.js index 15ded1986..4a135e051 100644 --- a/backend/src/seed/factories/tags.js +++ b/backend/src/seed/factories/tags.js @@ -5,9 +5,9 @@ export default function(params) { return { mutation: ` - mutation($id: ID!, $name: String!) { - CreateTag(id: $id, name: $name) { - name + mutation($id: ID!) { + CreateTag(id: $id) { + id } } `, diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index e1eab98c1..4abade0fa 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -42,9 +42,9 @@ Given("we have a selection of tags and categories as well as posts", () => { slug: "health-wellbeing", icon: "medkit" }) - .create("Tag", { id: "t1", name: "Ecology" }) - .create("Tag", { id: "t2", name: "Nature" }) - .create("Tag", { id: "t3", name: "Democracy" }); + .create("Tag", { id: "Ecology" }) + .create("Tag", { id: "Nature" }) + .create("Tag", { id: "Democracy" }); const someAuthor = { id: "authorId", @@ -71,14 +71,14 @@ Given("we have a selection of tags and categories as well as posts", () => { .relate("Post", "Categories", { from: "p0", to: "cat1" }) .relate("Post", "Categories", { from: "p1", to: "cat2" }) .relate("Post", "Categories", { from: "p2", to: "cat1" }) - .relate("Post", "Tags", { from: "p0", to: "t1" }) - .relate("Post", "Tags", { from: "p0", to: "t2" }) - .relate("Post", "Tags", { from: "p0", to: "t3" }) - .relate("Post", "Tags", { from: "p1", to: "t2" }) - .relate("Post", "Tags", { from: "p1", to: "t3" }) - .relate("Post", "Tags", { from: "p2", to: "t2" }) - .relate("Post", "Tags", { from: "p2", to: "t3" }) - .relate("Post", "Tags", { from: "p3", to: "t3" }); + .relate("Post", "Tags", { from: "p0", to: "Ecology" }) + .relate("Post", "Tags", { from: "p0", to: "Nature" }) + .relate("Post", "Tags", { from: "p0", to: "Democracy" }) + .relate("Post", "Tags", { from: "p1", to: "Nature" }) + .relate("Post", "Tags", { from: "p1", to: "Democracy" }) + .relate("Post", "Tags", { from: "p2", to: "Nature" }) + .relate("Post", "Tags", { from: "p2", to: "Democracy" }) + .relate("Post", "Tags", { from: "p3", to: "Democracy" }); }); Given("we have the following user accounts:", table => { diff --git a/neo4j/db_setup.sh b/neo4j/db_setup.sh index d4c7b9af8..51276cf39 100755 --- a/neo4j/db_setup.sh +++ b/neo4j/db_setup.sh @@ -29,7 +29,6 @@ CREATE CONSTRAINT ON (u:User) ASSERT u.id IS UNIQUE; CREATE CONSTRAINT ON (o:Organization) ASSERT o.id IS UNIQUE; CREATE CONSTRAINT ON (t:Tag) ASSERT t.id IS UNIQUE; - CREATE CONSTRAINT ON (p:Post) ASSERT p.slug IS UNIQUE; CREATE CONSTRAINT ON (c:Category) ASSERT c.slug IS UNIQUE; CREATE CONSTRAINT ON (u:User) ASSERT u.slug IS UNIQUE; diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index dca23a882..9d1c92cc9 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -244,9 +244,8 @@ export default { query() { return gql` { - Tag(orderBy: name_asc) { + Tag(orderBy: id_asc) { id - name } } ` diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index 4a4880eeb..fce3889d2 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -12,15 +12,13 @@ @click="selectItem(item)" >
@{{ item.slug }}
-
#{{ item.name }}
+
#{{ item.id }}
-
+
{{ $t('editor.hashtag.addHashtag') }}
-
- #{{ query }} -
+
#{{ query }}
@@ -40,9 +38,7 @@
{{ $t('editor.hashtag.addHashtag') }}
-
- #{{ query }} -
+
#{{ query }}
@@ -455,7 +451,7 @@ export default { // For hashtags handles pressing of space. spaceHandler() { if (this.suggestionType === this.hashtagSuggestionType && this.query !== '') { - this.selectItem({ name: this.query }) + this.selectItem({ id: this.query }) } }, // we have to replace our suggestion text with a mention @@ -467,8 +463,8 @@ export default { label: item.slug, }, hashtag: { - id: item.name, - label: item.name, + id: item.id, + label: item.id, }, } this.insertMentionOrHashtag({ diff --git a/webapp/components/Tag/index.vue b/webapp/components/Tag/index.vue index 9337c02a6..1895d4fcf 100644 --- a/webapp/components/Tag/index.vue +++ b/webapp/components/Tag/index.vue @@ -1,7 +1,7 @@ @@ -9,7 +9,7 @@ export default { name: 'HcTag', props: { - name: { type: String, required: true }, + id: { type: String, required: true }, }, } diff --git a/webapp/components/Tag/spec.js b/webapp/components/Tag/spec.js index 6a82ce641..4824c65fc 100644 --- a/webapp/components/Tag/spec.js +++ b/webapp/components/Tag/spec.js @@ -6,20 +6,20 @@ const localVue = createLocalVue() localVue.use(Styleguide) describe('Tag', () => { - let name + let id let Wrapper = () => { return shallowMount(Tag, { localVue, propsData: { - name, + id, }, }) } describe('given a String for Name', () => { beforeEach(() => { - name = 'Liebe' + id = 'Liebe' }) it('shows Name', () => { diff --git a/webapp/graphql/PostQuery.js b/webapp/graphql/PostQuery.js index 9d54a5d2b..f5da8dc56 100644 --- a/webapp/graphql/PostQuery.js +++ b/webapp/graphql/PostQuery.js @@ -34,7 +34,7 @@ export default i18n => { } } tags { - name + id } commentsCount comments(orderBy: createdAt_desc) { diff --git a/webapp/pages/admin/tags.vue b/webapp/pages/admin/tags.vue index c5a28dc11..9ede1d502 100644 --- a/webapp/pages/admin/tags.vue +++ b/webapp/pages/admin/tags.vue @@ -1,12 +1,12 @@