From 2f9b338d3a841a1c7e340c6f262354a2fc356ece Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 3 Jun 2019 22:32:19 +0000 Subject: [PATCH 001/178] Bump tiptap from 1.20.1 to 1.21.0 in /webapp Bumps [tiptap](https://github.com/scrumpy/tiptap) from 1.20.1 to 1.21.0. - [Release notes](https://github.com/scrumpy/tiptap/releases) - [Commits](https://github.com/scrumpy/tiptap/compare/tiptap@1.20.1...tiptap@1.21.0) --- webapp/package.json | 2 +- webapp/yarn.lock | 39 ++++----------------------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index a06ff5c7d..0c82bef0e 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.20.1", + "tiptap": "1.21.0", "tiptap-extensions": "1.20.2", "v-tooltip": "~2.0.2", "vue-count-to": "~1.0.13", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 1d9fe2e7e..46a25db85 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -9014,7 +9014,7 @@ prosemirror-state@^1.0.0, prosemirror-state@^1.2.2, prosemirror-state@^1.2.3: prosemirror-model "^1.0.0" prosemirror-transform "^1.0.0" -prosemirror-tables@^0.8.0, prosemirror-tables@^0.8.1: +prosemirror-tables@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/prosemirror-tables/-/prosemirror-tables-0.8.1.tgz#ea99ad4effec99dd4e2fdb0b33cce4d2547eed83" integrity sha512-6eY8I+NkyrXAQ1gmYkKo7XDLZaj0iGutdc/zT0+VMY15IzgBINwcRP62+miaCTuneLTKufMYzfUB37NjGJaetw== @@ -9032,17 +9032,12 @@ prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transfor dependencies: prosemirror-model "^1.0.0" -prosemirror-utils@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.8.2.tgz#e0e4a47cd45b1cff3d84464446d9f92adf4a558b" - integrity sha512-jNIj3/eREx4x2FU6pFEUDmdVmtoRBuLA6JTjgNum/84Nf+Ns+Y9l0Q//R8EL/Qm/5J5xTg5/s+hmQkXaHY+ilA== - prosemirror-utils@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.9.0.tgz#3ab616c94ccd61fcb18968f0d5aa273a9f1f28e4" integrity sha512-YcvmHcq7phbn+OagJSvmne92qZG9dOVfb3zfuA1HuyWUif3hUDt2Yfu299BHqVkEkUCF6FN7Gi9folDQntMhxA== -prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.9.6, prosemirror-view@^1.9.8: +prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.9.8: version "1.9.8" resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.9.8.tgz#47b961204a0b2e8ff87370c270d4f82598e81273" integrity sha512-yS4yrqxydvi7ddz9VFLeJgbfVd5g3/bMcRxb1PbWtG0i9OrPSsiHaEBJHLVeTbraGqRlAu+tbNLakO7RhUhp1w== @@ -10562,7 +10557,7 @@ tippy.js@^4.3.1: dependencies: popper.js "^1.14.7" -tiptap-commands@^1.10.5, tiptap-commands@^1.10.6: +tiptap-commands@^1.10.6: version "1.10.6" resolved "https://registry.yarnpkg.com/tiptap-commands/-/tiptap-commands-1.10.6.tgz#46f972aacbc8d175248ab7ed7e6183ebc6cc72ed" integrity sha512-62GrTo3Mmev3AmN0rFDa0gzUFQyN9yTjpuH6xMTo0OqMx6iTluqxdiROB2Hc+9qVCHj6qFwJIG4t8jPrYiuKuw== @@ -10593,16 +10588,6 @@ tiptap-extensions@1.20.2: tiptap "^1.21.0" tiptap-commands "^1.10.6" -tiptap-utils@^1.5.3: - version "1.5.3" - resolved "https://registry.yarnpkg.com/tiptap-utils/-/tiptap-utils-1.5.3.tgz#7d4518a84eb6bfb10c98b19c901ca59123865f61" - integrity sha512-025uF1acJ7jLuA9dnKIxp8TQelyQ0uJqtT1jlziT8UslwZT5pKzwDsNkadFbnEBp6O9wfLZH0TuUtAUDmuq0VA== - dependencies: - prosemirror-model "^1.7.0" - prosemirror-state "^1.2.3" - prosemirror-tables "^0.8.0" - prosemirror-utils "^0.8.2" - tiptap-utils@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/tiptap-utils/-/tiptap-utils-1.5.4.tgz#c64b65d305ee70793376c9cec1da242ebf6e1884" @@ -10613,23 +10598,7 @@ tiptap-utils@^1.5.4: prosemirror-tables "^0.8.1" prosemirror-utils "^0.9.0" -tiptap@1.20.1: - 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" - prosemirror-gapcursor "^1.0.3" - prosemirror-inputrules "^1.0.4" - prosemirror-keymap "^1.0.1" - prosemirror-model "^1.7.0" - prosemirror-state "^1.2.3" - prosemirror-view "^1.9.6" - tiptap-commands "^1.10.5" - tiptap-utils "^1.5.3" - -tiptap@^1.21.0: +tiptap@1.21.0, tiptap@^1.21.0: version "1.21.0" resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.21.0.tgz#4d8c1365c611e41c8d4f3d7aa195ddaf891e605b" integrity sha512-MoOj/8OPMlmoAotIZjAIlUZ59yMMR83xReOw2rGjqbFOooncoY1rLEBp0xz5oe5FLYqoe8dKb+kzOoFERqckVQ== From 8cd62078f2cf90313a82ab0c245ff271bad65958 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Tue, 4 Jun 2019 21:24:02 -0300 Subject: [PATCH 002/178] Start DeleteAccount functionality --- .../DeleteAccount/DeleteAccount.vue | 71 +++++++++++++++++++ webapp/locales/en.json | 2 +- webapp/pages/settings.vue | 12 ++-- webapp/pages/settings/delete-account.vue | 8 +-- 4 files changed, 80 insertions(+), 13 deletions(-) create mode 100644 webapp/components/DeleteAccount/DeleteAccount.vue diff --git a/webapp/components/DeleteAccount/DeleteAccount.vue b/webapp/components/DeleteAccount/DeleteAccount.vue new file mode 100644 index 000000000..b73142a52 --- /dev/null +++ b/webapp/components/DeleteAccount/DeleteAccount.vue @@ -0,0 +1,71 @@ + + + diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 8330f97b2..3520f0d56 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -71,7 +71,7 @@ "name": "Download Data" }, "delete": { - "name": "Delete Account" + "name": "Delete my User Account" }, "organizations": { "name": "My Organizations" diff --git a/webapp/pages/settings.vue b/webapp/pages/settings.vue index f6745cdf3..a273b8b63 100644 --- a/webapp/pages/settings.vue +++ b/webapp/pages/settings.vue @@ -1,8 +1,6 @@ diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index c92cdae52..49d76f252 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -12,13 +12,12 @@ > - + @@ -241,7 +240,6 @@ import HcEmpty from '~/components/Empty.vue' import ContentMenu from '~/components/ContentMenu' import HcUpload from '~/components/Upload' import HcAvatar from '~/components/Avatar/Avatar.vue' -import PostMutationHelpers from '~/mixins/PostMutationHelpers' export default { components: { @@ -256,7 +254,6 @@ export default { ContentMenu, HcUpload, }, - mixins: [PostMutationHelpers], transition: { name: 'slide-up', mode: 'out-in', @@ -267,35 +264,6 @@ export default { voted: false, page: 1, pageSize: 6, - modalsData: { - delete: { - titel: () => { - this.$t('delete.contribution.title') - }, - message: () => { - const name = this.$filters.truncate(this.name, 30) - return this.$t(`delete.contribution.message`, { name }) - }, - buttons: { - confirm: { - icon: 'trash', - text: () => { - this.$t('delete.submit') - }, - callback: this.deletePostCallback, - }, - cancel: { - icon: 'close', - text: () => { - this.$t('delete.cancel') - }, - callback: () => {}, - }, - }, - }, - disableCallbacks: { confirmCallback: () => {}, cancelCallback: () => {} }, - reportCallbacks: { confirmCallback: () => {}, cancelCallback: () => {} }, - }, } }, computed: { From 70aa77bd2eb8b5d9a390ee4cfb7a4bce3e533f15 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Fri, 7 Jun 2019 13:37:59 -0300 Subject: [PATCH 008/178] Get user deletion working from UI --- .../DeleteAccount/DeleteAccount.vue | 41 +++++++++++++++---- webapp/locales/en.json | 3 +- webapp/pages/post/_id/_slug/index.vue | 6 +-- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/webapp/components/DeleteAccount/DeleteAccount.vue b/webapp/components/DeleteAccount/DeleteAccount.vue index dd03da648..d7e102d28 100644 --- a/webapp/components/DeleteAccount/DeleteAccount.vue +++ b/webapp/components/DeleteAccount/DeleteAccount.vue @@ -59,7 +59,12 @@ - + {{ $t('settings.delete.name') }} @@ -71,6 +76,7 @@ diff --git a/webapp/components/PostHelpers.js b/webapp/components/PostHelpers.js new file mode 100644 index 000000000..df2064bfc --- /dev/null +++ b/webapp/components/PostHelpers.js @@ -0,0 +1,42 @@ +import gql from 'graphql-tag' + +export default { + postMenuModalsData: (postNameShort, confirmCallback) => { + return { + delete: { + titleIdent: 'delete.contribution.title', + messageIdent: 'delete.contribution.message', + messageParams: { + name: postNameShort, + }, + buttons: { + confirm: { + icon: 'trash', + textIdent: 'delete.submit', + callback: confirmCallback, + }, + cancel: { + icon: 'close', + textIdent: 'delete.cancel', + callback: () => {}, + }, + }, + }, + } + }, + deletePostMutationData(postId) { + var gqlMutation = gql` + mutation($id: ID!) { + DeletePost(id: $id) { + id + } + } + ` + return { + mutation: gqlMutation, + variables: { + id: postId, + }, + } + }, +} diff --git a/webapp/mixins/PostMutationHelpers.js b/webapp/mixins/PostMutationHelpers.js deleted file mode 100644 index 68e4c73b8..000000000 --- a/webapp/mixins/PostMutationHelpers.js +++ /dev/null @@ -1,61 +0,0 @@ -import gql from 'graphql-tag' - -export default { - data() { - return { - menuModalsData: { - delete: { - titleIdent: 'delete.contribution.title', - messageIdent: 'delete.contribution.message', - messageParams: { - // "this.post" is not defined at the beginning … - name: this.post ? this.$filters.truncate(this.post.title, 30) : '', - }, - buttons: { - confirm: { - icon: 'trash', - textIdent: 'delete.submit', - callback: this.deletePostCallback, - }, - cancel: { - icon: 'close', - textIdent: 'delete.cancel', - callback: () => {}, - }, - }, - }, - }, - } - }, - methods: { - async deletePostCallback(postDisplayType = 'list') { - try { - var gqlMutation = gql` - mutation($id: ID!) { - DeletePost(id: $id) { - id - } - } - ` - await this.$apollo.mutate({ - mutation: gqlMutation, - variables: { - id: this.post.id, - }, - }) - this.$toast.success(this.$t('delete.contribution.success')) - switch (postDisplayType) { - case 'list': - this.$emit('deletePost') - break - default: - // case 'page': - this.$router.history.push('/') // Single page type: Redirect to index (main) page - break - } - } catch (err) { - this.$toast.error(err.message) - } - }, - }, -} diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index 5bf4ea168..8a073ac6e 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -56,7 +56,7 @@ describe('PostSlug', () => { beforeEach(jest.useFakeTimers) - describe('test mixin "PostMutationHelpers"', () => { + describe('test "PostHelpers"', () => { beforeEach(() => { wrapper = Wrapper() wrapper.setData({ diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 4d703ff7e..63b0713c5 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -13,7 +13,7 @@ placement="bottom-end" resource-type="contribution" :resource="post" - :modalsData="menuModalsDataPage()" + :modalsData="menuModalsData" :is-owner="isAuthor(post.author.id)" /> @@ -71,7 +71,7 @@ import HcUser from '~/components/User' import HcShoutButton from '~/components/ShoutButton.vue' import HcCommentForm from '~/components/comments/CommentForm' import HcCommentList from '~/components/comments/CommentList' -import PostMutationHelpers from '~/mixins/PostMutationHelpers' +import PostHelpers from '~/components/PostHelpers' export default { name: 'PostSlug', @@ -88,7 +88,6 @@ export default { HcCommentForm, HcCommentList, }, - mixins: [PostMutationHelpers], head() { return { title: this.title, @@ -210,14 +209,27 @@ export default { this.ready = true }, 50) }, + computed: { + // "this.post" may not always be defined at the beginning … + menuModalsData() { + return PostHelpers.postMenuModalsData( + this.post ? this.$filters.truncate(this.post.title, 30) : '', + this.deletePostCallback, + ) + }, + }, methods: { isAuthor(id) { return this.$store.getters['auth/user'].id === id }, - menuModalsDataPage() { - const locMenuModalsData = this.menuModalsData - locMenuModalsData.delete.buttons.confirm.callback = () => this.deletePostCallback('page') - return locMenuModalsData + async deletePostCallback() { + try { + await this.$apollo.mutate(PostHelpers.deletePostMutationData(this.post.id)) + this.$toast.success(this.$t('delete.contribution.success')) + this.$router.history.push('/') // Redirect to index (main) page + } catch (err) { + this.$toast.error(err.message) + } }, }, } diff --git a/webapp/pages/profile/_id/_slug.spec.js b/webapp/pages/profile/_id/_slug.spec.js index d79f9b885..ddebe50f6 100644 --- a/webapp/pages/profile/_id/_slug.spec.js +++ b/webapp/pages/profile/_id/_slug.spec.js @@ -46,7 +46,7 @@ describe('ProfileSlug', () => { beforeEach(jest.useFakeTimers) - describe('test mixin "PostMutationHelpers"', () => { + describe('test "PostHelpers"', () => { beforeEach(() => { wrapper = Wrapper() }) @@ -60,7 +60,7 @@ describe('ProfileSlug', () => { beforeEach(jest.runAllTimers) it('emits "deletePost"', () => { - expect(wrapper.emitted().deletePost.length).toBe(1) + expect(wrapper.emitted().deletePost).toHaveLength(1) }) it('does not go to index (main) page', () => { From ebe951f05ba350f46c04447070f8f151375311f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 12 Jun 2019 10:43:44 +0200 Subject: [PATCH 024/178] Update tiptap to 1.21.0 --- webapp/package.json | 2 +- webapp/yarn.lock | 37 +++++++++++-------------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index e230839f5..7662a1f7a 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.20.1", + "tiptap": "1.21.0", "tiptap-extensions": "1.21.0", "v-tooltip": "~2.0.2", "vue-count-to": "~1.0.13", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index dc5df4b79..c85e962d7 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -9020,7 +9020,7 @@ prosemirror-state@^1.0.0, prosemirror-state@^1.2.2, prosemirror-state@^1.2.3: prosemirror-model "^1.0.0" prosemirror-transform "^1.0.0" -prosemirror-tables@^0.8.0, prosemirror-tables@^0.8.1: +prosemirror-tables@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/prosemirror-tables/-/prosemirror-tables-0.8.1.tgz#ea99ad4effec99dd4e2fdb0b33cce4d2547eed83" integrity sha512-6eY8I+NkyrXAQ1gmYkKo7XDLZaj0iGutdc/zT0+VMY15IzgBINwcRP62+miaCTuneLTKufMYzfUB37NjGJaetw== @@ -9038,17 +9038,12 @@ prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transfor dependencies: prosemirror-model "^1.0.0" -prosemirror-utils@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.8.2.tgz#e0e4a47cd45b1cff3d84464446d9f92adf4a558b" - integrity sha512-jNIj3/eREx4x2FU6pFEUDmdVmtoRBuLA6JTjgNum/84Nf+Ns+Y9l0Q//R8EL/Qm/5J5xTg5/s+hmQkXaHY+ilA== - prosemirror-utils@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.9.0.tgz#3ab616c94ccd61fcb18968f0d5aa273a9f1f28e4" integrity sha512-YcvmHcq7phbn+OagJSvmne92qZG9dOVfb3zfuA1HuyWUif3hUDt2Yfu299BHqVkEkUCF6FN7Gi9folDQntMhxA== -prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.9.6, prosemirror-view@^1.9.8: +prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.9.8: version "1.9.8" resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.9.8.tgz#47b961204a0b2e8ff87370c270d4f82598e81273" integrity sha512-yS4yrqxydvi7ddz9VFLeJgbfVd5g3/bMcRxb1PbWtG0i9OrPSsiHaEBJHLVeTbraGqRlAu+tbNLakO7RhUhp1w== @@ -10568,7 +10563,7 @@ tippy.js@^4.3.2: dependencies: popper.js "^1.14.7" -tiptap-commands@^1.10.5, tiptap-commands@^1.10.7: +tiptap-commands@^1.10.6, tiptap-commands@^1.10.7: version "1.10.7" resolved "https://registry.yarnpkg.com/tiptap-commands/-/tiptap-commands-1.10.7.tgz#c177f875e8a90e05171fdd441190b4b7a769bd27" integrity sha512-Ij62dHkYvOFUcaj+xlbahhoqcY8bFIEho6fXKrxcjjtGzS2DyJnvXmWN6Ow65uZWXkf5Zf8ae6XnYNaKqP3Pyg== @@ -10599,17 +10594,7 @@ tiptap-extensions@1.21.0: tiptap "^1.21.1" tiptap-commands "^1.10.7" -tiptap-utils@^1.5.3: - version "1.5.3" - resolved "https://registry.yarnpkg.com/tiptap-utils/-/tiptap-utils-1.5.3.tgz#7d4518a84eb6bfb10c98b19c901ca59123865f61" - integrity sha512-025uF1acJ7jLuA9dnKIxp8TQelyQ0uJqtT1jlziT8UslwZT5pKzwDsNkadFbnEBp6O9wfLZH0TuUtAUDmuq0VA== - dependencies: - prosemirror-model "^1.7.0" - prosemirror-state "^1.2.3" - prosemirror-tables "^0.8.0" - prosemirror-utils "^0.8.2" - -tiptap-utils@^1.5.5: +tiptap-utils@^1.5.4, tiptap-utils@^1.5.5: version "1.5.5" resolved "https://registry.yarnpkg.com/tiptap-utils/-/tiptap-utils-1.5.5.tgz#f06c70f0319d9215433b3466b6ece369a078de0f" integrity sha512-lnaCmIIkyK050qfsPeMDjoTW0sTqBHxfw1h2GXaX5Nr6JF4VQe0izgf2MI6LCd3PKecJBoW4ce5lNkDpV99+WA== @@ -10619,10 +10604,10 @@ tiptap-utils@^1.5.5: prosemirror-tables "^0.8.1" prosemirror-utils "^0.9.0" -tiptap@1.20.1: - version "1.20.1" - resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.20.1.tgz#d10fd0cd73a96bbb1f2d581da02ceda38fa8695b" - integrity sha512-uVGxPknq+cQH0G8yyCHvo8p3jPMLZMnkLeFjcrTyiY9PXl6XsSJwOjtIg4GXnIyCcfz2jWI5mhJGzCD26cdJGA== +tiptap@1.21.0: + version "1.21.0" + resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.21.0.tgz#4d8c1365c611e41c8d4f3d7aa195ddaf891e605b" + integrity sha512-MoOj/8OPMlmoAotIZjAIlUZ59yMMR83xReOw2rGjqbFOooncoY1rLEBp0xz5oe5FLYqoe8dKb+kzOoFERqckVQ== dependencies: prosemirror-commands "^1.0.8" prosemirror-dropcursor "^1.1.1" @@ -10631,9 +10616,9 @@ tiptap@1.20.1: prosemirror-keymap "^1.0.1" prosemirror-model "^1.7.0" prosemirror-state "^1.2.3" - prosemirror-view "^1.9.6" - tiptap-commands "^1.10.5" - tiptap-utils "^1.5.3" + prosemirror-view "^1.9.8" + tiptap-commands "^1.10.6" + tiptap-utils "^1.5.4" tiptap@^1.21.1: version "1.21.1" From dba719ea1c8f0ef93fbca9a3c8dd570953febdd2 Mon Sep 17 00:00:00 2001 From: senderfm Date: Wed, 12 Jun 2019 12:54:33 +0200 Subject: [PATCH 025/178] english translation changes undone. --- webapp/locales/en.json | 2 +- webapp/locales/es.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/locales/en.json b/webapp/locales/en.json index fe17f7b48..54b9e598e 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -14,7 +14,7 @@ "hello": "Hello" }, "editor": { - "placeholder": "Write something inspiring..." + "placeholder": "Leave your inspirational thoughts..." }, "profile": { "name": "My Profile", diff --git a/webapp/locales/es.json b/webapp/locales/es.json index bdff69850..af9c21c3f 100644 --- a/webapp/locales/es.json +++ b/webapp/locales/es.json @@ -38,7 +38,7 @@ "failed": "no encontró nada" }, "settings": { - "name": "Ajustes", + "name": "Configuración", "data": { "name": "Sus datos", "labelName": "Su nombre", From 8eb089d21806aa04b745b57d94cb520e994f69c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 12 Jun 2019 15:58:23 +0200 Subject: [PATCH 026/178] Rename event deletePost to removePostFromList Co-Authored-By: mattwr18 --- webapp/components/Modal/DeleteModal.spec.js | 2 +- webapp/components/PostCard/index.vue | 4 +- webapp/components/PostHelpers.js | 2 +- webapp/pages/index.vue | 2 +- webapp/pages/post/_id/_slug/index.vue | 2 +- webapp/pages/post/_id/_slug/more-info.vue | 23 +++---- webapp/pages/profile/_id/_slug.vue | 71 +++++++++++---------- 7 files changed, 52 insertions(+), 54 deletions(-) diff --git a/webapp/components/Modal/DeleteModal.spec.js b/webapp/components/Modal/DeleteModal.spec.js index c5e9df001..3401d5ba3 100644 --- a/webapp/components/Modal/DeleteModal.spec.js +++ b/webapp/components/Modal/DeleteModal.spec.js @@ -164,7 +164,7 @@ describe('DeleteModal.vue', () => { expect(propsData.callbacks.confirm).toHaveBeenCalledTimes(1) }) it('emits close', () => { - expect(wrapper.emitted().close).toBeTruthy() + expect(wrapper.emitted().close).toHaveLength(1) }) it('resets success', () => { diff --git a/webapp/components/PostCard/index.vue b/webapp/components/PostCard/index.vue index 96e1f5d72..383f879bd 100644 --- a/webapp/components/PostCard/index.vue +++ b/webapp/components/PostCard/index.vue @@ -103,8 +103,8 @@ export default { return this.user.id === this.post.author.id }, menuModalsData() { - // "this.post" may not always be defined at the beginning … return PostHelpers.postMenuModalsData( + // "this.post" may not always be defined at the beginning … this.post ? this.$filters.truncate(this.post.title, 30) : '', this.deletePostCallback, ) @@ -115,7 +115,7 @@ export default { try { await this.$apollo.mutate(PostHelpers.deletePostMutationData(this.post.id)) this.$toast.success(this.$t('delete.contribution.success')) - this.$emit('deletePost') + this.$emit('removePostFromList') } catch (err) { this.$toast.error(err.message) } diff --git a/webapp/components/PostHelpers.js b/webapp/components/PostHelpers.js index df2064bfc..4a30e6a22 100644 --- a/webapp/components/PostHelpers.js +++ b/webapp/components/PostHelpers.js @@ -1,7 +1,7 @@ import gql from 'graphql-tag' export default { - postMenuModalsData: (postNameShort, confirmCallback) => { + postMenuModalsData(postNameShort, confirmCallback) { return { delete: { titleIdent: 'delete.contribution.title', diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index d8becf206..10a64ee0f 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -9,7 +9,7 @@ :key="post.id" :post="post" :width="{ base: '100%', xs: '100%', md: '50%', xl: '33%' }" - @deletePost="deletePost(index, post.id)" + @removePostFromList="deletePost(index, post.id)" /> diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 63b0713c5..899950514 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -210,9 +210,9 @@ export default { }, 50) }, computed: { - // "this.post" may not always be defined at the beginning … menuModalsData() { return PostHelpers.postMenuModalsData( + // "this.post" may not always be defined at the beginning … this.post ? this.$filters.truncate(this.post.title, 30) : '', this.deletePostCallback, ) diff --git a/webapp/pages/post/_id/_slug/more-info.vue b/webapp/pages/post/_id/_slug/more-info.vue index 1cb93ae6c..00de48730 100644 --- a/webapp/pages/post/_id/_slug/more-info.vue +++ b/webapp/pages/post/_id/_slug/more-info.vue @@ -1,13 +1,10 @@ - + Wer folgt {{ userName | truncate(15) }}? @@ -101,13 +102,14 @@ - + - - und {{ user.followedByCount - user.followedBy.length }} weitere - + und {{ user.followedByCount - user.followedBy.length }} weitere -
- No users found -
+
No users found
@@ -175,6 +173,7 @@ import { History, } from 'tiptap-extensions' import Mention from './nodes/Mention.js' +import { mapGetters } from 'vuex' let throttleInputEvent @@ -212,7 +211,7 @@ export default { new ListItem(), new Placeholder({ emptyNodeClass: 'is-empty', - emptyNodeText: this.$t('editor.placeholder'), + emptyNodeText: this.placeholder || this.$t('editor.placeholder'), }), new History(), new Mention({ @@ -297,6 +296,7 @@ export default { } }, computed: { + ...mapGetters({ placeholder: 'editor/placeholder' }), hasResults() { return this.filteredUsers.length }, @@ -316,20 +316,20 @@ export default { this.editor.setContent(content) }, }, - }, - mounted() { - this.$root.$on('changeLanguage', () => { - this.changePlaceHolderText() - }) + placeholder: { + immediate: true, + handler: function(val) { + if (!val) { + return + } + this.editor.extensions.options.placeholder.emptyNodeText = val + }, + }, }, beforeDestroy() { - this.$root.$off('changeLanguage') 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/Editor/spec.js b/webapp/components/Editor/spec.js index 249192b57..b982d941d 100644 --- a/webapp/components/Editor/spec.js +++ b/webapp/components/Editor/spec.js @@ -1,31 +1,43 @@ import { mount, createLocalVue } from '@vue/test-utils' import Editor from './' +import Vuex from 'vuex' import Styleguide from '@human-connection/styleguide' const localVue = createLocalVue() +localVue.use(Vuex) localVue.use(Styleguide) describe('Editor.vue', () => { let wrapper let propsData let mocks + let getters beforeEach(() => { propsData = {} mocks = { $t: () => {}, } + getters = { + 'editor/placeholder': () => { + return 'some cool placeholder' + }, + } }) describe('mount', () => { let Wrapper = () => { + const store = new Vuex.Store({ + getters, + }) return (wrapper = mount(Editor, { mocks, propsData, localVue, sync: false, stubs: { transition: false }, + store, })) } @@ -43,5 +55,13 @@ describe('Editor.vue', () => { expect(wrapper.find('.ProseMirror').text()).toContain('I am a piece of text') }) }) + + describe('uses the placeholder', () => { + it('from the store', () => { + expect(wrapper.vm.editor.extensions.options.placeholder.emptyNodeText).toEqual( + 'some cool placeholder', + ) + }) + }) }) }) diff --git a/webapp/components/LocaleSwitch.vue b/webapp/components/LocaleSwitch.vue index f6f1a9727..aeee580b5 100644 --- a/webapp/components/LocaleSwitch.vue +++ b/webapp/components/LocaleSwitch.vue @@ -36,6 +36,7 @@ import Dropdown from '~/components/Dropdown' import find from 'lodash/find' import orderBy from 'lodash/orderBy' +import { mapMutations } from 'vuex' export default { components: { @@ -65,10 +66,11 @@ export default { }, }, methods: { + ...mapMutations({ setPlaceholderText: 'editor/SET_PLACEHOLDER_TEXT' }), changeLanguage(locale, toggleMenu) { this.$i18n.set(locale) toggleMenu() - this.$root.$emit('changeLanguage') + this.setPlaceholderText(this.$t('editor.placeholder')) }, matcher(locale) { return locale === this.$i18n.locale() diff --git a/webapp/store/editor.js b/webapp/store/editor.js new file mode 100644 index 000000000..9c5f665a0 --- /dev/null +++ b/webapp/store/editor.js @@ -0,0 +1,17 @@ +export const state = () => { + return { + placeholder: null, + } +} + +export const getters = { + placeholder(state) { + return state.placeholder + }, +} + +export const mutations = { + SET_PLACEHOLDER_TEXT(state, text) { + state.placeholder = text + }, +} diff --git a/webapp/store/editor.spec.js b/webapp/store/editor.spec.js new file mode 100644 index 000000000..90477ea20 --- /dev/null +++ b/webapp/store/editor.spec.js @@ -0,0 +1,20 @@ +import { getters, mutations } from './editor.js' + +let state + +describe('getters', () => { + describe('placeholder', () => { + it('return the value in state', () => { + state = { placeholder: null } + expect(getters.placeholder(state)).toBe(null) + }) + }) +}) + +describe('mutations', () => { + it('SET_PLACEHOLDER_TEXT', () => { + state = { placeholder: null } + mutations.SET_PLACEHOLDER_TEXT(state, 'new placeholder') + expect(getters.placeholder(state)).toBe('new placeholder') + }) +}) From 4adc450f439c06c645ea7bc46f16b8cccfffe953 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Sat, 15 Jun 2019 15:53:30 -0300 Subject: [PATCH 073/178] Fix failing test - add Vuex, with editor/placeholder getter --- .../ContributionForm/ContributionForm.spec.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index f7f306fc3..8b741443f 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -1,9 +1,11 @@ import { config, mount, createLocalVue } from '@vue/test-utils' import ContributionForm from './index.vue' import Styleguide from '@human-connection/styleguide' +import Vuex from 'vuex' const localVue = createLocalVue() +localVue.use(Vuex) localVue.use(Styleguide) config.stubs['no-ssr'] = '' @@ -53,8 +55,16 @@ describe('ContributionForm.vue', () => { }) describe('mount', () => { + const getters = { + 'editor/placeholder': () => { + return 'some cool placeholder' + }, + } + const store = new Vuex.Store({ + getters, + }) const Wrapper = () => { - return mount(ContributionForm, { mocks, localVue, computed }) + return mount(ContributionForm, { mocks, localVue, computed, store }) } beforeEach(() => { From 01eb25eca67311526e9377a83cf3f4198a787d7b Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Sat, 15 Jun 2019 16:15:49 -0300 Subject: [PATCH 074/178] Update CommentForm with vuex --- webapp/components/comments/CommentForm/spec.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/webapp/components/comments/CommentForm/spec.js b/webapp/components/comments/CommentForm/spec.js index ded57348c..16a4d454d 100644 --- a/webapp/components/comments/CommentForm/spec.js +++ b/webapp/components/comments/CommentForm/spec.js @@ -1,9 +1,10 @@ import { mount, createLocalVue, createWrapper } from '@vue/test-utils' import CommentForm from './index.vue' import Styleguide from '@human-connection/styleguide' +import Vuex from 'vuex' const localVue = createLocalVue() - +localVue.use(Vuex) localVue.use(Styleguide) describe('CommentForm.vue', () => { @@ -35,8 +36,16 @@ describe('CommentForm.vue', () => { }) describe('mount', () => { + const getters = { + 'editor/placeholder': () => { + return 'some cool placeholder' + }, + } + const store = new Vuex.Store({ + getters, + }) const Wrapper = () => { - return mount(CommentForm, { mocks, localVue, propsData }) + return mount(CommentForm, { mocks, localVue, propsData, store }) } beforeEach(() => { From 145a8d8bf65efa55fd53e5a70d711ed5241aa11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2019 23:01:22 +0200 Subject: [PATCH 075/178] Check invalid email Sending a mail with further instructions even if the email is invalid seems to be a good practice: A potential attacker will not now if a user has an account under that email address. If a user does not remember the email address, but has control over the other mail account, she will get feedback that this mail account is incorrect. --- .../schema/resolvers/passwordReset.spec.js | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/backend/src/schema/resolvers/passwordReset.spec.js b/backend/src/schema/resolvers/passwordReset.spec.js index 3b0d39864..4bd29c9c6 100644 --- a/backend/src/schema/resolvers/passwordReset.spec.js +++ b/backend/src/schema/resolvers/passwordReset.spec.js @@ -30,34 +30,51 @@ describe('passwordReset', () => { }) describe('requestPasswordReset', () => { - const variables = { email: 'user@example.org' } const mutation = `mutation($email: String!) { requestPasswordReset(email: $email) }` - it('resolves', async () => { - await expect(client.request(mutation, variables)).resolves.toEqual({"requestPasswordReset": true}) + describe('with invalid email', () => { + const variables = { email: 'non-existent@example.org' } + + it('resolves anyways', async () => { + await expect(client.request(mutation, variables)).resolves.toEqual({"requestPasswordReset": true}) + }) + + it('creates no node', async () => { + await client.request(mutation, variables) + const resets = await getAllPasswordResets() + expect(resets).toHaveLength(0) + }) }) - it('creates node with label `PasswordReset`', async () => { - await client.request(mutation, variables) - const resets = await getAllPasswordResets() - expect(resets).toHaveLength(1) - }) + describe('with a valid email', () => { + const variables = { email: 'user@example.org' } - it('creates an id used as a reset token', async () => { - await client.request(mutation, variables) - const [reset] = await getAllPasswordResets() - const { id: token } = reset.properties - expect(token).toMatch(/^........-....-....-....-............$/) - }) + it('resolves', async () => { + await expect(client.request(mutation, variables)).resolves.toEqual({"requestPasswordReset": true}) + }) - it('created PasswordReset is valid for less than 4 minutes', async () => { - await client.request(mutation, variables) - const [reset] = await getAllPasswordResets() - let { validUntil } = reset.properties - validUntil = Date.parse(validUntil) - const now = (new Date()).getTime() - expect(validUntil).toBeGreaterThan(now - 60*1000) - expect(validUntil).toBeLessThan(now + 4*60*1000) + it('creates node with label `PasswordReset`', async () => { + await client.request(mutation, variables) + const resets = await getAllPasswordResets() + expect(resets).toHaveLength(1) + }) + + it('creates an id used as a reset token', async () => { + await client.request(mutation, variables) + const [reset] = await getAllPasswordResets() + const { id: token } = reset.properties + expect(token).toMatch(/^........-....-....-....-............$/) + }) + + it('created PasswordReset is valid for less than 4 minutes', async () => { + await client.request(mutation, variables) + const [reset] = await getAllPasswordResets() + let { validUntil } = reset.properties + validUntil = Date.parse(validUntil) + const now = (new Date()).getTime() + expect(validUntil).toBeGreaterThan(now - 60*1000) + expect(validUntil).toBeLessThan(now + 4*60*1000) + }) }) }) }) From c9ea956f858c631e0735cc93ab28f571ed55bedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sun, 16 Jun 2019 00:08:36 +0200 Subject: [PATCH 076/178] Test+Implement resetPassword --- .../src/middleware/permissionsMiddleware.js | 1 + backend/src/schema/resolvers/passwordReset.js | 53 +++++-- .../schema/resolvers/passwordReset.spec.js | 143 ++++++++++++++++-- backend/src/schema/types/schema.gql | 2 +- 4 files changed, 174 insertions(+), 25 deletions(-) diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index ad2787579..dbcde849c 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -148,6 +148,7 @@ const permissions = shield( DeleteComment: isAuthor, DeleteUser: isDeletingOwnAccount, requestPasswordReset: allow, + resetPassword: allow, }, User: { email: isMyOwn, diff --git a/backend/src/schema/resolvers/passwordReset.js b/backend/src/schema/resolvers/passwordReset.js index f3e1d32d2..d6d2a6e6c 100644 --- a/backend/src/schema/resolvers/passwordReset.js +++ b/backend/src/schema/resolvers/passwordReset.js @@ -1,21 +1,46 @@ -export default { - Mutation: { - requestPasswordReset: async (_, { email }, { driver }) => { - const session = driver.session() - let validUntil = new Date() - validUntil += 3*60*1000 - const cypher = ` - MATCH(u:User) WHERE u.email = $email - CREATE(pr:PasswordReset {id: apoc.create.uuid(), validUntil: $validUntil, redeemedAt: NULL}) +import uuid from 'uuid/v4' +import bcrypt from 'bcryptjs' + +export async function createPasswordReset({ driver, token, email, validUntil }) { + const session = driver.session() + const cypher = ` + MATCH (u:User) WHERE u.email = $email + CREATE(pr:PasswordReset {token: $token, validUntil: $validUntil, redeemedAt: NULL}) MERGE (u)-[:REQUESTED]->(pr) RETURN u,pr ` - await session.run(cypher, { email, validUntil }) - session.close() + const transactionRes = await session.run(cypher, { token, email, validUntil }) + const resets = transactionRes.records.map(record => record.get('pr')) + session.close() + return resets +} + +export default { + Mutation: { + requestPasswordReset: async (_, { email }, { driver }) => { + let validUntil = new Date() + validUntil += 3 * 60 * 1000 + const token = uuid() + await createPasswordReset({ driver, token, email, validUntil }) return true }, resetPassword: async (_, { email, token, newPassword }, { driver }) => { - throw Error('Not Implemented') - } - } + const session = driver.session() + const now = new Date().getTime() + const newHashedPassword = await bcrypt.hashSync(newPassword, 10) + const cypher = ` + MATCH (r:PasswordReset {token: $token}) + MATCH (u:User {email: $email})-[:REQUESTED]->(r) + WHERE r.validUntil > $now AND r.redeemedAt IS NULL + SET r.redeemedAt = $now + SET u.password = $newHashedPassword + RETURN r + ` + let transactionRes = await session.run(cypher, { now, email, token, newHashedPassword }) + const [reset] = transactionRes.records.map(record => record.get('r')) + const result = !!(reset && reset.properties.redeemedAt) + session.close() + return result + }, + }, } diff --git a/backend/src/schema/resolvers/passwordReset.spec.js b/backend/src/schema/resolvers/passwordReset.spec.js index 4bd29c9c6..89b724fca 100644 --- a/backend/src/schema/resolvers/passwordReset.spec.js +++ b/backend/src/schema/resolvers/passwordReset.spec.js @@ -1,7 +1,8 @@ import { GraphQLClient } from 'graphql-request' import Factory from '../../seed/factories' -import { host, login } from '../../jest/helpers' +import { host } from '../../jest/helpers' import { getDriver } from '../../bootstrap/neo4j' +import { createPasswordReset } from './passwordReset' const factory = Factory() let client @@ -36,7 +37,9 @@ describe('passwordReset', () => { const variables = { email: 'non-existent@example.org' } it('resolves anyways', async () => { - await expect(client.request(mutation, variables)).resolves.toEqual({"requestPasswordReset": true}) + await expect(client.request(mutation, variables)).resolves.toEqual({ + requestPasswordReset: true, + }) }) it('creates no node', async () => { @@ -50,7 +53,9 @@ describe('passwordReset', () => { const variables = { email: 'user@example.org' } it('resolves', async () => { - await expect(client.request(mutation, variables)).resolves.toEqual({"requestPasswordReset": true}) + await expect(client.request(mutation, variables)).resolves.toEqual({ + requestPasswordReset: true, + }) }) it('creates node with label `PasswordReset`', async () => { @@ -59,21 +64,139 @@ describe('passwordReset', () => { expect(resets).toHaveLength(1) }) - it('creates an id used as a reset token', async () => { + it('creates a reset token', async () => { await client.request(mutation, variables) - const [reset] = await getAllPasswordResets() - const { id: token } = reset.properties + const resets = await getAllPasswordResets() + const [reset] = resets + const { token } = reset.properties expect(token).toMatch(/^........-....-....-....-............$/) }) it('created PasswordReset is valid for less than 4 minutes', async () => { await client.request(mutation, variables) - const [reset] = await getAllPasswordResets() + const resets = await getAllPasswordResets() + const [reset] = resets let { validUntil } = reset.properties validUntil = Date.parse(validUntil) - const now = (new Date()).getTime() - expect(validUntil).toBeGreaterThan(now - 60*1000) - expect(validUntil).toBeLessThan(now + 4*60*1000) + const now = new Date().getTime() + expect(validUntil).toBeGreaterThan(now - 60 * 1000) + expect(validUntil).toBeLessThan(now + 4 * 60 * 1000) + }) + }) + }) + + describe('resetPassword', () => { + const setup = async (options = {}) => { + const { + email = 'user@example.org', + validUntil = new Date().getTime() + 3 * 60 * 1000, + token = 'abcdefgh-ijkl-mnop-qrst-uvwxyz123456', + } = options + + const session = driver.session() + await createPasswordReset({ driver, email, validUntil, token }) + session.close() + } + + const mutation = `mutation($token: String!, $email: String!, $newPassword: String!) { resetPassword(token: $token, email: $email, newPassword: $newPassword) }` + let email = 'user@example.org' + let token = 'abcdefgh-ijkl-mnop-qrst-uvwxyz123456' + let newPassword = 'supersecret' + let variables + + describe('invalid email', () => { + it('resolves to false', async () => { + await setup() + variables = { newPassword, email: 'non-existent@example.org', token } + await expect(client.request(mutation, variables)).resolves.toEqual({ resetPassword: false }) + }) + }) + + describe('valid email', () => { + describe('but invalid token', () => { + it('resolves to false', async () => { + await setup() + variables = { newPassword, email, token: 'slkdjfldsjflsdjfsjdfl' } + await expect(client.request(mutation, variables)).resolves.toEqual({ + resetPassword: false, + }) + }) + }) + + describe('but invalid token', () => { + it('resolves to false', async () => { + variables = { newPassword, email: 'user@example.org', token: 'lksjdflksjdflksjdlkfjsf' } + await expect(client.request(mutation, variables)).resolves.toEqual({ + resetPassword: false, + }) + }) + }) + + describe('and valid token', () => { + beforeEach(() => { + variables = { + newPassword, + email: 'user@example.org', + token: 'abcdefgh-ijkl-mnop-qrst-uvwxyz123456', + } + }) + + describe('and token not expired', () => { + beforeEach(async () => { + await setup() + }) + + it('resolves to true', async () => { + await expect(client.request(mutation, variables)).resolves.toEqual({ + resetPassword: true, + }) + }) + + it('updates PasswordReset `redeemedAt` property', async () => { + await client.request(mutation, variables) + const requests = await getAllPasswordResets() + const [request] = requests + const { redeemedAt } = request.properties + expect(redeemedAt).not.toBeNull() + }) + + it('updates password of the user', async () => { + await client.request(mutation, variables) + const checkLoginMutation = ` + mutation($email: String!, $password: String!) { + login(email: $email, password: $password) + } + ` + const expected = expect.objectContaining({ login: expect.any(String) }) + await expect( + client.request(checkLoginMutation, { + email: 'user@example.org', + password: 'supersecret', + }), + ).resolves.toEqual(expected) + }) + }) + + describe('but expired token', () => { + beforeEach(async () => { + const validUntil = new Date().getTime() - 1000 + await setup({ validUntil }) + }) + + it('resolves to false', async () => { + await expect(client.request(mutation, variables)).resolves.toEqual({ + resetPassword: false, + }) + }) + + it('does not update PasswordReset `redeemedAt` property', async () => { + await client.request(mutation, variables) + const requests = await getAllPasswordResets() + const [request] = requests + const { redeemedAt } = request.properties + expect(redeemedAt).toBeUndefined() + }) + }) }) }) }) diff --git a/backend/src/schema/types/schema.gql b/backend/src/schema/types/schema.gql index 358797631..ae77ef8e8 100644 --- a/backend/src/schema/types/schema.gql +++ b/backend/src/schema/types/schema.gql @@ -26,7 +26,7 @@ type Mutation { signup(email: String!, password: String!): Boolean! changePassword(oldPassword: String!, newPassword: String!): String! requestPasswordReset(email: String!): Boolean! - resetPassword(email: String!, resetToken: String!, newPassword: String!): String! + resetPassword(email: String!, token: String!, newPassword: String!): Boolean! report(id: ID!, description: String): Report disable(id: ID!): ID enable(id: ID!): ID From 31dde68ff23c3d36417b0161dff88c9495f5c73a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 04:56:26 +0000 Subject: [PATCH 077/178] Bump date-fns from 2.0.0-alpha.33 to 2.0.0-alpha.34 in /webapp Bumps [date-fns](https://github.com/date-fns/date-fns) from 2.0.0-alpha.33 to 2.0.0-alpha.34. - [Release notes](https://github.com/date-fns/date-fns/releases) - [Changelog](https://github.com/date-fns/date-fns/blob/master/CHANGELOG.md) - [Commits](https://github.com/date-fns/date-fns/compare/v2.0.0-alpha.33...v2.0.0-alpha.34) 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 1abaf479b..5e42d0332 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -59,7 +59,7 @@ "apollo-client": "~2.6.2", "cookie-universal-nuxt": "~2.0.16", "cross-env": "~5.2.0", - "date-fns": "2.0.0-alpha.33", + "date-fns": "2.0.0-alpha.34", "express": "~4.17.1", "graphql": "~14.3.1", "jsonwebtoken": "~8.5.1", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index e5c1daf8a..de0d07924 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -3754,10 +3754,10 @@ data-urls@^1.0.0: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" -date-fns@2.0.0-alpha.33: - version "2.0.0-alpha.33" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.33.tgz#c2f73c3cc50ac301c9217eb93603c9bc40e891bf" - integrity sha512-tqUVEk3oxnJuNIvwAMKHAMo4uFRG0zXvjxZQll+BonoPt+m4NMcUgO14NDxbHuy7uYcrVErd2GdSsw02EDZQ7w== +date-fns@2.0.0-alpha.34: + version "2.0.0-alpha.34" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.34.tgz#5d3ae7ca0d08915ccfc87a20545250af4e9c3cae" + integrity sha512-yjSYUHASHvzOZl++cEms+Tw7oQOFA+7Z6/lL7L3lRO9j6pMfT48N6oEyvCGo/MVlH08XWmydgf8X9Y1eedf9sQ== date-now@^0.1.4: version "0.1.4" From 1cdaef179eeaea8a24fca216bb64a64feedc7630 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 04:56:53 +0000 Subject: [PATCH 078/178] Bump eslint-config-prettier from 4.3.0 to 5.0.0 in /webapp Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 4.3.0 to 5.0.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v4.3.0...v5.0.0) 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 1abaf479b..5f926320b 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -90,7 +90,7 @@ "babel-eslint": "~10.0.1", "babel-jest": "~24.8.0", "eslint": "~5.16.0", - "eslint-config-prettier": "~4.3.0", + "eslint-config-prettier": "~5.0.0", "eslint-config-standard": "~12.0.0", "eslint-loader": "~2.1.2", "eslint-plugin-import": "~2.17.3", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index e5c1daf8a..dcf099ab7 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -4236,10 +4236,10 @@ eslint-config-prettier@^3.3.0: dependencies: get-stdin "^6.0.0" -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== +eslint-config-prettier@~5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-5.0.0.tgz#f7a94b2b8ae7cbf25842c36fa96c6d32cd0a697c" + integrity sha512-c17Aqiz5e8LEqoc/QPmYnaxQFAHTx2KlCZBPxXXjEMmNchOLnV/7j0HoPZuC+rL/tDC9bazUYOKJW9bOhftI/w== dependencies: get-stdin "^6.0.0" From dc420d4116b37607ceeba737c0000f9f5bdf1c76 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 04:57:46 +0000 Subject: [PATCH 079/178] Bump date-fns from 2.0.0-alpha.33 to 2.0.0-alpha.34 in /backend Bumps [date-fns](https://github.com/date-fns/date-fns) from 2.0.0-alpha.33 to 2.0.0-alpha.34. - [Release notes](https://github.com/date-fns/date-fns/releases) - [Changelog](https://github.com/date-fns/date-fns/blob/master/CHANGELOG.md) - [Commits](https://github.com/date-fns/date-fns/compare/v2.0.0-alpha.33...v2.0.0-alpha.34) Signed-off-by: dependabot-preview[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 c8537ae0b..d0ecf618c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -52,7 +52,7 @@ "cheerio": "~1.0.0-rc.3", "cors": "~2.8.5", "cross-env": "~5.2.0", - "date-fns": "2.0.0-alpha.33", + "date-fns": "2.0.0-alpha.34", "debug": "~4.1.1", "dotenv": "~8.0.0", "express": "~4.17.1", diff --git a/backend/yarn.lock b/backend/yarn.lock index d2c5da176..c8a5b4254 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -2586,10 +2586,10 @@ data-urls@^1.0.0: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" -date-fns@2.0.0-alpha.33: - version "2.0.0-alpha.33" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.33.tgz#c2f73c3cc50ac301c9217eb93603c9bc40e891bf" - integrity sha512-tqUVEk3oxnJuNIvwAMKHAMo4uFRG0zXvjxZQll+BonoPt+m4NMcUgO14NDxbHuy7uYcrVErd2GdSsw02EDZQ7w== +date-fns@2.0.0-alpha.34: + version "2.0.0-alpha.34" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.34.tgz#5d3ae7ca0d08915ccfc87a20545250af4e9c3cae" + integrity sha512-yjSYUHASHvzOZl++cEms+Tw7oQOFA+7Z6/lL7L3lRO9j6pMfT48N6oEyvCGo/MVlH08XWmydgf8X9Y1eedf9sQ== debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" From 8ff98cbc25f8fbe315c1021d61d87207541edc80 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 04:58:20 +0000 Subject: [PATCH 080/178] Bump apollo-link-context from 1.0.17 to 1.0.18 in /backend Bumps [apollo-link-context](https://github.com/apollographql/apollo-link) from 1.0.17 to 1.0.18. - [Release notes](https://github.com/apollographql/apollo-link/releases) - [Changelog](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md) - [Commits](https://github.com/apollographql/apollo-link/compare/apollo-link-context@1.0.17...apollo-link-context@1.0.18) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/backend/package.json b/backend/package.json index c8537ae0b..47d080de3 100644 --- a/backend/package.json +++ b/backend/package.json @@ -45,7 +45,7 @@ "activitystrea.ms": "~2.1.3", "apollo-cache-inmemory": "~1.6.2", "apollo-client": "~2.6.2", - "apollo-link-context": "~1.0.14", + "apollo-link-context": "~1.0.18", "apollo-link-http": "~1.5.14", "apollo-server": "~2.6.3", "bcryptjs": "~2.4.3", diff --git a/backend/yarn.lock b/backend/yarn.lock index d2c5da176..200370ea2 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1388,12 +1388,12 @@ apollo-graphql@^0.3.0: apollo-env "0.5.1" lodash.sortby "^4.7.0" -apollo-link-context@~1.0.14: - version "1.0.17" - resolved "https://registry.yarnpkg.com/apollo-link-context/-/apollo-link-context-1.0.17.tgz#439272cfb43ec1891506dd175ed907845b7de36c" - integrity sha512-W5UUfHcrrlP5uqJs5X1zbf84AMXhPZGAqX/7AQDgR6wY/7//sMGfJvm36KDkpIeSOElztGtM9z6zdPN1NbT41Q== +apollo-link-context@~1.0.18: + version "1.0.18" + resolved "https://registry.yarnpkg.com/apollo-link-context/-/apollo-link-context-1.0.18.tgz#9e700e3314da8ded50057fee0a18af2bfcedbfc3" + integrity sha512-aG5cbUp1zqOHHQjAJXG7n/izeMQ6LApd/whEF5z6qZp5ATvcyfSNkCfy3KRJMMZZ3iNfVTs6jF+IUA8Zvf+zeg== dependencies: - apollo-link "^1.2.11" + apollo-link "^1.2.12" tslib "^1.9.3" apollo-link-http-common@^0.2.13: @@ -1414,15 +1414,15 @@ apollo-link-http@~1.5.14: apollo-link-http-common "^0.2.13" tslib "^1.9.3" -apollo-link@^1.0.0, apollo-link@^1.2.11, apollo-link@^1.2.3: - version "1.2.11" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.11.tgz#493293b747ad3237114ccd22e9f559e5e24a194d" - integrity sha512-PQvRCg13VduLy3X/0L79M6uOpTh5iHdxnxYuo8yL7sJlWybKRJwsv4IcRBJpMFbChOOaHY7Og9wgPo6DLKDKDA== +apollo-link@^1.0.0, apollo-link@^1.2.11, apollo-link@^1.2.12, apollo-link@^1.2.3: + version "1.2.12" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.12.tgz#014b514fba95f1945c38ad4c216f31bcfee68429" + integrity sha512-fsgIAXPKThyMVEMWQsUN22AoQI+J/pVXcjRGAShtk97h7D8O+SPskFinCGEkxPeQpE83uKaqafB2IyWdjN+J3Q== dependencies: - apollo-utilities "^1.2.1" - ts-invariant "^0.3.2" + apollo-utilities "^1.3.0" + ts-invariant "^0.4.0" tslib "^1.9.3" - zen-observable-ts "^0.8.18" + zen-observable-ts "^0.8.19" apollo-server-caching@0.4.0: version "0.4.0" @@ -1566,7 +1566,7 @@ apollo-upload-server@^7.0.0: http-errors "^1.7.0" object-path "^0.11.4" -apollo-utilities@1.3.2, apollo-utilities@^1.0.1, apollo-utilities@^1.2.1, apollo-utilities@^1.3.2: +apollo-utilities@1.3.2, apollo-utilities@^1.0.1, apollo-utilities@^1.3.0, apollo-utilities@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.2.tgz#8cbdcf8b012f664cd6cb5767f6130f5aed9115c9" integrity sha512-JWNHj8XChz7S4OZghV6yc9FNnzEXj285QYp/nLNh943iObycI5GTDO3NGR9Dth12LRrSFMeDOConPfPln+WGfg== @@ -8112,10 +8112,10 @@ yup@^0.27.0: synchronous-promise "^2.0.6" toposort "^2.0.2" -zen-observable-ts@^0.8.18: - version "0.8.18" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.18.tgz#ade44b1060cc4a800627856ec10b9c67f5f639c8" - integrity sha512-q7d05s75Rn1j39U5Oapg3HI2wzriVwERVo4N7uFGpIYuHB9ff02P/E92P9B8T7QVC93jCMHpbXH7X0eVR5LA7A== +zen-observable-ts@^0.8.19: + version "0.8.19" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.19.tgz#c094cd20e83ddb02a11144a6e2a89706946b5694" + integrity sha512-u1a2rpE13G+jSzrg3aiCqXU5tN2kw41b+cBZGmnc+30YimdkKiDj9bTowcB41eL77/17RF/h+393AuVgShyheQ== dependencies: tslib "^1.9.3" zen-observable "^0.8.0" From 4566980eaafa63d19f54311d445246d6c52cbae3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 04:58:59 +0000 Subject: [PATCH 081/178] Bump eslint-config-prettier from 4.3.0 to 5.0.0 in /backend Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 4.3.0 to 5.0.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v4.3.0...v5.0.0) Signed-off-by: dependabot-preview[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 c8537ae0b..f4fa102ab 100644 --- a/backend/package.json +++ b/backend/package.json @@ -94,7 +94,7 @@ "chai": "~4.2.0", "cucumber": "~5.1.0", "eslint": "~5.16.0", - "eslint-config-prettier": "~4.3.0", + "eslint-config-prettier": "~5.0.0", "eslint-config-standard": "~12.0.0", "eslint-plugin-import": "~2.17.3", "eslint-plugin-jest": "~22.6.4", diff --git a/backend/yarn.lock b/backend/yarn.lock index d2c5da176..89ea212e4 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -2995,10 +2995,10 @@ 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== +eslint-config-prettier@~5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-5.0.0.tgz#f7a94b2b8ae7cbf25842c36fa96c6d32cd0a697c" + integrity sha512-c17Aqiz5e8LEqoc/QPmYnaxQFAHTx2KlCZBPxXXjEMmNchOLnV/7j0HoPZuC+rL/tDC9bazUYOKJW9bOhftI/w== dependencies: get-stdin "^6.0.0" From 7458fd62e222f43845a5f89de84c59358d1db789 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 04:59:16 +0000 Subject: [PATCH 082/178] Bump apollo-link-http from 1.5.14 to 1.5.15 in /backend Bumps [apollo-link-http](https://github.com/apollographql/apollo-link) from 1.5.14 to 1.5.15. - [Release notes](https://github.com/apollographql/apollo-link/releases) - [Changelog](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md) - [Commits](https://github.com/apollographql/apollo-link/compare/apollo-link-http@1.5.14...apollo-link-http@1.5.15) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 55 +++++++++++++++++++------------------------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/backend/package.json b/backend/package.json index c8537ae0b..a20dbe698 100644 --- a/backend/package.json +++ b/backend/package.json @@ -46,7 +46,7 @@ "apollo-cache-inmemory": "~1.6.2", "apollo-client": "~2.6.2", "apollo-link-context": "~1.0.14", - "apollo-link-http": "~1.5.14", + "apollo-link-http": "~1.5.15", "apollo-server": "~2.6.3", "bcryptjs": "~2.4.3", "cheerio": "~1.0.0-rc.3", diff --git a/backend/yarn.lock b/backend/yarn.lock index d2c5da176..d53e5af20 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1396,33 +1396,33 @@ apollo-link-context@~1.0.14: 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" - integrity sha512-Uyg1ECQpTTA691Fwx5e6Rc/6CPSu4TB4pQRTGIpwZ4l5JDOQ+812Wvi/e3IInmzOZpwx5YrrOfXrtN8BrsDXoA== +apollo-link-http-common@^0.2.14: + version "0.2.14" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.14.tgz#d3a195c12e00f4e311c417f121181dcc31f7d0c8" + integrity sha512-v6mRU1oN6XuX8beVIRB6OpF4q1ULhSnmy7ScnHnuo1qV6GaFmDcbdvXqxIkAV1Q8SQCo2lsv4HeqJOWhFfApOg== dependencies: - apollo-link "^1.2.11" - ts-invariant "^0.3.2" + apollo-link "^1.2.12" + ts-invariant "^0.4.0" tslib "^1.9.3" -apollo-link-http@~1.5.14: - version "1.5.14" - resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.14.tgz#ed6292248d1819ccd16523e346d35203a1b31109" - integrity sha512-XEoPXmGpxFG3wioovgAlPXIarWaW4oWzt8YzjTYZ87R4R7d1A3wKR/KcvkdMV1m5G7YSAHcNkDLe/8hF2nH6cg== +apollo-link-http@~1.5.15: + version "1.5.15" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.15.tgz#106ab23bb8997bd55965d05855736d33119652cf" + integrity sha512-epZFhCKDjD7+oNTVK3P39pqWGn4LEhShAoA1Q9e2tDrBjItNfviiE33RmcLcCURDYyW5JA6SMgdODNI4Is8tvQ== dependencies: - apollo-link "^1.2.11" - apollo-link-http-common "^0.2.13" + apollo-link "^1.2.12" + apollo-link-http-common "^0.2.14" tslib "^1.9.3" -apollo-link@^1.0.0, apollo-link@^1.2.11, apollo-link@^1.2.3: - version "1.2.11" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.11.tgz#493293b747ad3237114ccd22e9f559e5e24a194d" - integrity sha512-PQvRCg13VduLy3X/0L79M6uOpTh5iHdxnxYuo8yL7sJlWybKRJwsv4IcRBJpMFbChOOaHY7Og9wgPo6DLKDKDA== +apollo-link@^1.0.0, apollo-link@^1.2.11, apollo-link@^1.2.12, apollo-link@^1.2.3: + version "1.2.12" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.12.tgz#014b514fba95f1945c38ad4c216f31bcfee68429" + integrity sha512-fsgIAXPKThyMVEMWQsUN22AoQI+J/pVXcjRGAShtk97h7D8O+SPskFinCGEkxPeQpE83uKaqafB2IyWdjN+J3Q== dependencies: - apollo-utilities "^1.2.1" - ts-invariant "^0.3.2" + apollo-utilities "^1.3.0" + ts-invariant "^0.4.0" tslib "^1.9.3" - zen-observable-ts "^0.8.18" + zen-observable-ts "^0.8.19" apollo-server-caching@0.4.0: version "0.4.0" @@ -1566,7 +1566,7 @@ apollo-upload-server@^7.0.0: http-errors "^1.7.0" object-path "^0.11.4" -apollo-utilities@1.3.2, apollo-utilities@^1.0.1, apollo-utilities@^1.2.1, apollo-utilities@^1.3.2: +apollo-utilities@1.3.2, apollo-utilities@^1.0.1, apollo-utilities@^1.3.0, apollo-utilities@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.2.tgz#8cbdcf8b012f664cd6cb5767f6130f5aed9115c9" integrity sha512-JWNHj8XChz7S4OZghV6yc9FNnzEXj285QYp/nLNh943iObycI5GTDO3NGR9Dth12LRrSFMeDOConPfPln+WGfg== @@ -7543,13 +7543,6 @@ trunc-text@1.0.1: resolved "https://registry.yarnpkg.com/trunc-text/-/trunc-text-1.0.1.tgz#58f876d8ac59b224b79834bb478b8656e69622b5" integrity sha1-WPh22KxZsiS3mDS7R4uGVuaWIrU= -ts-invariant@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.3.2.tgz#89a2ffeb70879b777258df1df1c59383c35209b0" - integrity sha512-QsY8BCaRnHiB5T6iE4DPlJMAKEG3gzMiUco9FEt1jUXQf0XP6zi0idT0i0rMTu8A326JqNSDsmlkA9dRSh1TRg== - 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" @@ -8112,10 +8105,10 @@ yup@^0.27.0: synchronous-promise "^2.0.6" toposort "^2.0.2" -zen-observable-ts@^0.8.18: - version "0.8.18" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.18.tgz#ade44b1060cc4a800627856ec10b9c67f5f639c8" - integrity sha512-q7d05s75Rn1j39U5Oapg3HI2wzriVwERVo4N7uFGpIYuHB9ff02P/E92P9B8T7QVC93jCMHpbXH7X0eVR5LA7A== +zen-observable-ts@^0.8.19: + version "0.8.19" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.19.tgz#c094cd20e83ddb02a11144a6e2a89706946b5694" + integrity sha512-u1a2rpE13G+jSzrg3aiCqXU5tN2kw41b+cBZGmnc+30YimdkKiDj9bTowcB41eL77/17RF/h+393AuVgShyheQ== dependencies: tslib "^1.9.3" zen-observable "^0.8.0" From 65df4c5a20b9d05cd08cfd4a33cebab1ccc29461 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 17 Jun 2019 12:16:15 +0200 Subject: [PATCH 083/178] use replace instead of substring --- .../maintenance-worker/migration/neo4j/badges.cql | 2 +- .../maintenance-worker/migration/neo4j/contributions.cql | 2 +- .../maintenance-worker/migration/neo4j/users.cql | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql index 2d1548d4f..027cea019 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql @@ -45,7 +45,7 @@ MERGE(b:Badge {id: badge._id["$oid"]}) ON CREATE SET b.key = badge.key, b.type = badge.type, -b.icon = substring(badge.image.path, 38), +b.icon = replace(badge.image.path, 'https://api-alpha.human-connection.org', ''), b.status = badge.status, b.createdAt = badge.createdAt.`$date`, b.updatedAt = badge.updatedAt.`$date` diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql index 70f09e035..472354763 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql @@ -131,7 +131,7 @@ MERGE (p:Post {id: post._id["$oid"]}) ON CREATE SET p.title = post.title, p.slug = post.slug, -p.image = substring(post.teaserImg, 38), +p.image = replace(post.teaserImg, 'https://api-alpha.human-connection.org', ''), p.content = post.content, p.contentExcerpt = post.contentExcerpt, p.visibility = toLower(post.visibility), diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql index 96251a9ce..4d7c9aa9f 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql @@ -102,8 +102,8 @@ u.name = user.name, u.slug = user.slug, u.email = user.email, u.password = user.password, -u.avatar = substring(user.avatar, 38), -u.coverImg = substring(user.coverImg, 38), +u.avatar = replace(user.avatar, 'https://api-alpha.human-connection.org', ''), +u.coverImg = replace(user.coverImg, 'https://api-alpha.human-connection.org', ''), u.wasInvited = user.wasInvited, u.wasSeeded = user.wasSeeded, u.role = toLower(user.role), From 5a806ca99e3fba3e178954d462c0f5b32610f078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 12:24:14 +0200 Subject: [PATCH 084/178] Remove duplicate test case --- backend/src/schema/resolvers/passwordReset.spec.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/backend/src/schema/resolvers/passwordReset.spec.js b/backend/src/schema/resolvers/passwordReset.spec.js index 89b724fca..1fbd96b7a 100644 --- a/backend/src/schema/resolvers/passwordReset.spec.js +++ b/backend/src/schema/resolvers/passwordReset.spec.js @@ -123,15 +123,6 @@ describe('passwordReset', () => { }) }) - describe('but invalid token', () => { - it('resolves to false', async () => { - variables = { newPassword, email: 'user@example.org', token: 'lksjdflksjdflksjdlkfjsf' } - await expect(client.request(mutation, variables)).resolves.toEqual({ - resetPassword: false, - }) - }) - }) - describe('and valid token', () => { beforeEach(() => { variables = { From 7228d68149e10517be360f1f6db3a08285ffd633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 12:30:39 +0200 Subject: [PATCH 085/178] Write a nice form to reset your password --- webapp/locales/de.json | 6 +++++- webapp/locales/en.json | 6 +++++- webapp/pages/password-reset.vue | 23 ++++++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index d783f9e37..14ab9d906 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -15,7 +15,11 @@ "hello": "Hallo" }, "password-reset": { - "title": "Passwort zurücksetzen" + "title": "Passwort zurücksetzen", + "form": { + "description": "Eine Mail zum Zurücksetzen des Passworts wird an die angegebene E-Mail Adresse geschickt.", + "submit": "Email anfordern" + } }, "editor": { "placeholder": "Schreib etwas Inspirierendes..." diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 3a5405eec..3c2b7c8d8 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -15,7 +15,11 @@ "hello": "Hello" }, "password-reset": { - "title": "Reset your password" + "title": "Reset your password", + "form": { + "description": "A password reset email will be sent to the given email address.", + "submit": "Request email" + } }, "editor": { "placeholder": "Leave your inspirational thoughts..." diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index 0205ea4f4..bd7da49be 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -3,9 +3,26 @@ - - {{ $t('password-reset.title') }} - + + +
+ + + + {{ $t('password-reset.form.description') }} + + + + {{ $t('password-reset.form.submit') }} + + +
+
From c4eb2178f241a7119028888c028768176c71dbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 12:39:36 +0200 Subject: [PATCH 086/178] Scaffold page component test for password reset --- webapp/pages/password-reset.spec.js | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 webapp/pages/password-reset.spec.js diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js new file mode 100644 index 000000000..3c1f5b286 --- /dev/null +++ b/webapp/pages/password-reset.spec.js @@ -0,0 +1,41 @@ +import { shallowMount, createLocalVue } from '@vue/test-utils' +import PasswordResetPage from './password-reset.vue' +import Styleguide from '@human-connection/styleguide' + +const localVue = createLocalVue() + +localVue.use(Styleguide) + +describe('ProfileSlug', () => { + let wrapper + let Wrapper + let mocks + + beforeEach(() => { + mocks = { + $toast: { + success: jest.fn(), + error: jest.fn(), + }, + $t: jest.fn(), + $apollo: { + loading: false, + mutate: jest.fn().mockResolvedValue(), + }, + } + }) + + describe('shallowMount', () => { + Wrapper = () => { + return shallowMount(PasswordResetPage, { + mocks, + localVue, + }) + } + + it('renders a password reset form', () => { + wrapper = Wrapper() + expect(wrapper.find('.password-reset-card').exists()).toBe(true) + }) + }) +}) From 4dde53f67d4dca075240c90466fd765c67e24d19 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 17 Jun 2019 13:30:18 +0200 Subject: [PATCH 087/178] added coverage report text in oder to fix coverage --- webapp/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/package.json b/webapp/package.json index 1abaf479b..4f203ef5c 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -29,6 +29,7 @@ "!**/?(*.)+(spec|test).js?(x)" ], "coverageReporters": [ + "text", "lcov" ], "transform": { @@ -110,4 +111,4 @@ "vue-jest": "~3.0.4", "vue-svg-loader": "~0.12.0" } -} +} \ No newline at end of file From a501e1145daf8ad8fe4200b19750963a2018a879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 14:02:25 +0200 Subject: [PATCH 088/178] Component test to call a mutation passes --- webapp/locales/de.json | 8 +++- webapp/locales/en.json | 8 +++- webapp/pages/password-reset.spec.js | 31 +++++++++++++-- webapp/pages/password-reset.vue | 59 +++++++++++++++++++++++++++-- 4 files changed, 96 insertions(+), 10 deletions(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 14ab9d906..7497648e1 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -18,7 +18,8 @@ "title": "Passwort zurücksetzen", "form": { "description": "Eine Mail zum Zurücksetzen des Passworts wird an die angegebene E-Mail Adresse geschickt.", - "submit": "Email anfordern" + "submit": "Email anfordern", + "submitted": "Eine E-Mail zum Zurücksetzen wurde angefordert" } }, "editor": { @@ -201,7 +202,10 @@ "name": "Name", "loadMore": "mehr laden", "loading": "wird geladen", - "reportContent": "Melden" + "reportContent": "Melden", + "validations": { + "email": "muss eine gültige E-Mail Adresse sein" + } }, "actions": { "loading": "lade", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 3c2b7c8d8..fd7968428 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -18,7 +18,8 @@ "title": "Reset your password", "form": { "description": "A password reset email will be sent to the given email address.", - "submit": "Request email" + "submit": "Request email", + "submitted": "Reset email was requested" } }, "editor": { @@ -201,7 +202,10 @@ "name": "Name", "loadMore": "load more", "loading": "loading", - "reportContent": "Report" + "reportContent": "Report", + "validations": { + "email": "must be a valid email address" + } }, "actions": { "loading": "loading", diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js index 3c1f5b286..bba001614 100644 --- a/webapp/pages/password-reset.spec.js +++ b/webapp/pages/password-reset.spec.js @@ -1,4 +1,4 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils' +import { mount, createLocalVue } from '@vue/test-utils' import PasswordResetPage from './password-reset.vue' import Styleguide from '@human-connection/styleguide' @@ -25,9 +25,9 @@ describe('ProfileSlug', () => { } }) - describe('shallowMount', () => { + describe('mount', () => { Wrapper = () => { - return shallowMount(PasswordResetPage, { + return mount(PasswordResetPage, { mocks, localVue, }) @@ -37,5 +37,30 @@ describe('ProfileSlug', () => { wrapper = Wrapper() expect(wrapper.find('.password-reset-card').exists()).toBe(true) }) + + describe('submit', () => { + beforeEach(async () => { + wrapper = Wrapper() + wrapper.find('input#email').setValue('mail@example.org') + await wrapper.find('form').trigger('submit') + }) + + it('calls requestPasswordReset graphql mutation', () => { + expect(mocks.$apollo.mutate).toHaveBeenCalled() + }) + + it.todo('delivers email to backend') + it.todo('disables form to avoid re-submission') + it.todo('displays a message that a password email was requested') + }) + + describe('given password reset token as URL param', () => { + it.todo('displays a form to update your password') + describe('submitting new password', () => { + it.todo('calls resetPassword graphql mutation') + it.todo('delivers new password to backend') + it.todo('displays success message') + }) + }) }) }) diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index bd7da49be..0ad9b7997 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -5,10 +5,17 @@ -
+ @@ -17,10 +24,12 @@ {{ $t('password-reset.form.description') }} - + {{ $t('password-reset.form.submit') }} - +
@@ -30,7 +39,51 @@ From de9ed55738f31442f81f19cbe9aa90c20c2947d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 14:29:24 +0200 Subject: [PATCH 089/178] Display nice success message on password reset --- webapp/locales/de.json | 2 +- webapp/locales/en.json | 2 +- webapp/pages/password-reset.spec.js | 18 ++++++++--- webapp/pages/password-reset.vue | 49 +++++++++++++++++++++-------- 4 files changed, 52 insertions(+), 19 deletions(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 7497648e1..88afa07e0 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -19,7 +19,7 @@ "form": { "description": "Eine Mail zum Zurücksetzen des Passworts wird an die angegebene E-Mail Adresse geschickt.", "submit": "Email anfordern", - "submitted": "Eine E-Mail zum Zurücksetzen wurde angefordert" + "submitted": "E-Mail verschickt an {email}" } }, "editor": { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index fd7968428..53ad9fb40 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -19,7 +19,7 @@ "form": { "description": "A password reset email will be sent to the given email address.", "submit": "Request email", - "submitted": "Reset email was requested" + "submitted": "Email sent to {email}" } }, "editor": { diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js index bba001614..e78ace4ba 100644 --- a/webapp/pages/password-reset.spec.js +++ b/webapp/pages/password-reset.spec.js @@ -20,7 +20,7 @@ describe('ProfileSlug', () => { $t: jest.fn(), $apollo: { loading: false, - mutate: jest.fn().mockResolvedValue(), + mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }), }, } }) @@ -49,9 +49,19 @@ describe('ProfileSlug', () => { expect(mocks.$apollo.mutate).toHaveBeenCalled() }) - it.todo('delivers email to backend') - it.todo('disables form to avoid re-submission') - it.todo('displays a message that a password email was requested') + it('delivers email to backend', () => { + const expected = expect.objectContaining({ variables: { email: 'mail@example.org' } }) + expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) + }) + + it('hides form to avoid re-submission', () => { + expect(wrapper.find('form').exists()).not.toBeTruthy() + }) + + it('displays a message that a password email was requested', () => { + const expected = ['password-reset.form.submitted', { email: 'mail@example.org' }] + expect(mocks.$t).toHaveBeenCalledWith(...expected) + }) }) describe('given password reset token as URL param', () => { diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index 0ad9b7997..9e7d2d195 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -6,11 +6,13 @@ + @submit="handleSubmit" + > + :loading="$apollo.loading" + primary + fullwidth + name="submit" + type="submit" + icon="envelope" + > {{ $t('password-reset.form.submit') }} +
+ + + + + + +
@@ -40,33 +56,43 @@ From 35428fbaaad0b061bb5466b9b3e781d59107d332 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Mon, 17 Jun 2019 10:07:53 -0300 Subject: [PATCH 090/178] Add test for LocaleSwitch --- .../LocaleSwitch/LocaleSwitch.spec.js | 68 +++++++++++++++++++ .../{ => LocaleSwitch}/LocaleSwitch.vue | 0 webapp/layouts/default.vue | 2 +- webapp/pages/login.vue | 2 +- 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 webapp/components/LocaleSwitch/LocaleSwitch.spec.js rename webapp/components/{ => LocaleSwitch}/LocaleSwitch.vue (100%) diff --git a/webapp/components/LocaleSwitch/LocaleSwitch.spec.js b/webapp/components/LocaleSwitch/LocaleSwitch.spec.js new file mode 100644 index 000000000..ae81881d6 --- /dev/null +++ b/webapp/components/LocaleSwitch/LocaleSwitch.spec.js @@ -0,0 +1,68 @@ +import { mount, createLocalVue } from '@vue/test-utils' +import Styleguide from '@human-connection/styleguide' +import Vuex from 'vuex' +import VTooltip from 'v-tooltip' +import LocaleSwitch from './LocaleSwitch.vue' +import { mutations } from '~/store/editor' + +const localVue = createLocalVue() + +localVue.use(Vuex) +localVue.use(Styleguide) +localVue.use(VTooltip) + +describe('LocaleSwitch.vue', () => { + let wrapper + let mocks + let computed + let deutschLanguageItem + + beforeEach(() => { + mocks = { + $i18n: { + locale: () => 'de', + set: jest.fn(), + }, + $t: jest.fn(), + setPlaceholderText: jest.fn(), + } + computed = { + current: () => { + return { code: 'en' } + }, + routes: () => { + return [ + { + name: 'English', + path: 'en', + }, + { + name: 'Deutsch', + path: 'de', + }, + ] + }, + } + }) + + describe('mount', () => { + const store = new Vuex.Store({ + mutations: { + 'editor/SET_PLACEHOLDER_TEXT': mutations.SET_PLACEHOLDER_TEXT, + }, + }) + const Wrapper = () => { + return mount(LocaleSwitch, { mocks, localVue, store, computed }) + } + beforeEach(() => { + wrapper = Wrapper() + wrapper.find('.locale-menu').trigger('click') + deutschLanguageItem = wrapper.findAll('li').at(1) + deutschLanguageItem.trigger('click') + }) + + it("changes a user's locale", () => { + expect(mocks.$i18n.set).toHaveBeenCalledTimes(1) + }) + }) +}) diff --git a/webapp/components/LocaleSwitch.vue b/webapp/components/LocaleSwitch/LocaleSwitch.vue similarity index 100% rename from webapp/components/LocaleSwitch.vue rename to webapp/components/LocaleSwitch/LocaleSwitch.vue diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue index 7708d6d2e..162bae0fb 100644 --- a/webapp/layouts/default.vue +++ b/webapp/layouts/default.vue @@ -92,7 +92,7 @@ diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index 9e7d2d195..98642cfe8 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -3,51 +3,7 @@ - - - - - - - {{ $t('password-reset.form.description') }} - - - - {{ $t('password-reset.form.submit') }} - - -
- - - - - - -
-
-
+
@@ -55,58 +11,12 @@ From aa6855434de199fa68e09125d0ea5642db759249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 17 Jun 2019 15:10:57 +0200 Subject: [PATCH 092/178] Emit `submitted` from PasswordReset component --- .../PasswordReset/PasswordReset.spec.js | 19 +++---- .../PasswordReset/PasswordReset.vue | 6 ++- .../PasswordReset/VerifyCode.spec.js | 50 +++++++++++++++++++ .../components/PasswordReset/VerifyCode.vue | 9 ++++ webapp/locales/de.json | 5 ++ webapp/locales/en.json | 5 ++ 6 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 webapp/components/PasswordReset/VerifyCode.spec.js create mode 100644 webapp/components/PasswordReset/VerifyCode.vue diff --git a/webapp/components/PasswordReset/PasswordReset.spec.js b/webapp/components/PasswordReset/PasswordReset.spec.js index e55b9273a..6284fed36 100644 --- a/webapp/components/PasswordReset/PasswordReset.spec.js +++ b/webapp/components/PasswordReset/PasswordReset.spec.js @@ -6,7 +6,7 @@ const localVue = createLocalVue() localVue.use(Styleguide) -describe('ProfileSlug', () => { +describe('PasswordReset', () => { let wrapper let Wrapper let mocks @@ -26,6 +26,8 @@ describe('ProfileSlug', () => { }) describe('mount', () => { + beforeEach(jest.useFakeTimers) + Wrapper = () => { return mount(PasswordReset, { mocks, @@ -35,7 +37,7 @@ describe('ProfileSlug', () => { it('renders a password reset form', () => { wrapper = Wrapper() - expect(wrapper.find('.password-reset-card').exists()).toBe(true) + expect(wrapper.find('.password-reset').exists()).toBe(true) }) describe('submit', () => { @@ -62,14 +64,13 @@ describe('ProfileSlug', () => { const expected = ['password-reset.form.submitted', { email: 'mail@example.org' }] expect(mocks.$t).toHaveBeenCalledWith(...expected) }) - }) - describe('given password reset token as URL param', () => { - it.todo('displays a form to update your password') - describe('submitting new password', () => { - it.todo('calls resetPassword graphql mutation') - it.todo('delivers new password to backend') - it.todo('displays success message') + describe('after animation', () => { + beforeEach(jest.runAllTimers) + + it('emits `submitted`', () => { + expect(wrapper.emitted('submitted')).toBeTruthy() + }) }) }) }) diff --git a/webapp/components/PasswordReset/PasswordReset.vue b/webapp/components/PasswordReset/PasswordReset.vue index 7a74bbe31..175207949 100644 --- a/webapp/components/PasswordReset/PasswordReset.vue +++ b/webapp/components/PasswordReset/PasswordReset.vue @@ -1,5 +1,5 @@ + + diff --git a/webapp/locales/de.json b/webapp/locales/de.json index dece0fcff..3610ff68b 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -24,8 +24,12 @@ }, "verify-code": { "form": { + "input": "Code eingeben", "description": "Öffne Deine E-Mail Postfach und gib den Code ein, den wir geschickt haben.", - "submit": "Sicherheitscode überprüfen" + "submit": "Sicherheitscode überprüfen", + "validations": { + "code": "muss genau 6 Buchstaben lang sein" + } } }, "editor": { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index d18603278..225c26391 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -26,7 +26,10 @@ "form": { "input": "Enter your code", "description": "Open your inbox and enter the code that we've sent to you.", - "submit": "Check security code" + "submit": "Check security code", + "validations": { + "code": "must be 6 characters long" + } } }, "editor": { From eadfbe6190d387abac27375f12701ee06a2af674 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Mon, 17 Jun 2019 21:17:00 +0000 Subject: [PATCH 096/178] Bump apollo-link-http from 1.5.14 to 1.5.15 in /backend Bumps [apollo-link-http](https://github.com/apollographql/apollo-link) from 1.5.14 to 1.5.15. - [Release notes](https://github.com/apollographql/apollo-link/releases) - [Changelog](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md) - [Commits](https://github.com/apollographql/apollo-link/compare/apollo-link-http@1.5.14...apollo-link-http@1.5.15) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 33 +++++++++++++-------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/backend/package.json b/backend/package.json index c6736e02b..ca6868036 100644 --- a/backend/package.json +++ b/backend/package.json @@ -46,7 +46,7 @@ "apollo-cache-inmemory": "~1.6.2", "apollo-client": "~2.6.2", "apollo-link-context": "~1.0.18", - "apollo-link-http": "~1.5.14", + "apollo-link-http": "~1.5.15", "apollo-server": "~2.6.3", "bcryptjs": "~2.4.3", "cheerio": "~1.0.0-rc.3", diff --git a/backend/yarn.lock b/backend/yarn.lock index d213dc7d1..bc1e958ff 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1396,25 +1396,25 @@ apollo-link-context@~1.0.18: apollo-link "^1.2.12" 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" - integrity sha512-Uyg1ECQpTTA691Fwx5e6Rc/6CPSu4TB4pQRTGIpwZ4l5JDOQ+812Wvi/e3IInmzOZpwx5YrrOfXrtN8BrsDXoA== +apollo-link-http-common@^0.2.14: + version "0.2.14" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.14.tgz#d3a195c12e00f4e311c417f121181dcc31f7d0c8" + integrity sha512-v6mRU1oN6XuX8beVIRB6OpF4q1ULhSnmy7ScnHnuo1qV6GaFmDcbdvXqxIkAV1Q8SQCo2lsv4HeqJOWhFfApOg== dependencies: - apollo-link "^1.2.11" - ts-invariant "^0.3.2" + apollo-link "^1.2.12" + ts-invariant "^0.4.0" tslib "^1.9.3" -apollo-link-http@~1.5.14: - version "1.5.14" - resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.14.tgz#ed6292248d1819ccd16523e346d35203a1b31109" - integrity sha512-XEoPXmGpxFG3wioovgAlPXIarWaW4oWzt8YzjTYZ87R4R7d1A3wKR/KcvkdMV1m5G7YSAHcNkDLe/8hF2nH6cg== +apollo-link-http@~1.5.15: + version "1.5.15" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.15.tgz#106ab23bb8997bd55965d05855736d33119652cf" + integrity sha512-epZFhCKDjD7+oNTVK3P39pqWGn4LEhShAoA1Q9e2tDrBjItNfviiE33RmcLcCURDYyW5JA6SMgdODNI4Is8tvQ== dependencies: - apollo-link "^1.2.11" - apollo-link-http-common "^0.2.13" + apollo-link "^1.2.12" + apollo-link-http-common "^0.2.14" tslib "^1.9.3" -apollo-link@^1.0.0, apollo-link@^1.2.11, apollo-link@^1.2.12, apollo-link@^1.2.3: +apollo-link@^1.0.0, apollo-link@^1.2.12, apollo-link@^1.2.3: version "1.2.12" resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.12.tgz#014b514fba95f1945c38ad4c216f31bcfee68429" integrity sha512-fsgIAXPKThyMVEMWQsUN22AoQI+J/pVXcjRGAShtk97h7D8O+SPskFinCGEkxPeQpE83uKaqafB2IyWdjN+J3Q== @@ -7543,13 +7543,6 @@ trunc-text@1.0.1: resolved "https://registry.yarnpkg.com/trunc-text/-/trunc-text-1.0.1.tgz#58f876d8ac59b224b79834bb478b8656e69622b5" integrity sha1-WPh22KxZsiS3mDS7R4uGVuaWIrU= -ts-invariant@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.3.2.tgz#89a2ffeb70879b777258df1df1c59383c35209b0" - integrity sha512-QsY8BCaRnHiB5T6iE4DPlJMAKEG3gzMiUco9FEt1jUXQf0XP6zi0idT0i0rMTu8A326JqNSDsmlkA9dRSh1TRg== - 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" From 994eecd2c246abc256920896ccfc89bcd62dbec8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Tue, 18 Jun 2019 05:04:09 +0000 Subject: [PATCH 097/178] Bump babel-eslint from 10.0.1 to 10.0.2 in /backend Bumps [babel-eslint](https://github.com/babel/babel-eslint) from 10.0.1 to 10.0.2. - [Release notes](https://github.com/babel/babel-eslint/releases) - [Commits](https://github.com/babel/babel-eslint/compare/v10.0.1...v10.0.2) Signed-off-by: dependabot-preview[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 ca6868036..e448310d4 100644 --- a/backend/package.json +++ b/backend/package.json @@ -89,7 +89,7 @@ "@babel/register": "~7.4.4", "apollo-server-testing": "~2.6.3", "babel-core": "~7.0.0-0", - "babel-eslint": "~10.0.1", + "babel-eslint": "~10.0.2", "babel-jest": "~24.8.0", "chai": "~4.2.0", "cucumber": "~5.1.0", diff --git a/backend/yarn.lock b/backend/yarn.lock index bc1e958ff..e044ecc1f 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1790,10 +1790,10 @@ babel-core@~7.0.0-0: resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== -babel-eslint@~10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" - integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== +babel-eslint@~10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" + integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q== dependencies: "@babel/code-frame" "^7.0.0" "@babel/parser" "^7.0.0" From ef5a20b3df9e51e60beeba43b14c05040d92974d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Tue, 18 Jun 2019 05:06:24 +0000 Subject: [PATCH 098/178] Bump babel-eslint from 10.0.1 to 10.0.2 in /webapp Bumps [babel-eslint](https://github.com/babel/babel-eslint) from 10.0.1 to 10.0.2. - [Release notes](https://github.com/babel/babel-eslint/releases) - [Commits](https://github.com/babel/babel-eslint/compare/v10.0.1...v10.0.2) 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 a3d8c6dda..5340149df 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -87,7 +87,7 @@ "@vue/server-test-utils": "~1.0.0-beta.29", "@vue/test-utils": "~1.0.0-beta.29", "babel-core": "~7.0.0-bridge.0", - "babel-eslint": "~10.0.1", + "babel-eslint": "~10.0.2", "babel-jest": "~24.8.0", "eslint": "~5.16.0", "eslint-config-prettier": "~5.0.0", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 80d519770..262c58021 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -2310,10 +2310,10 @@ babel-core@~7.0.0-bridge.0: resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== -babel-eslint@~10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" - integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== +babel-eslint@~10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" + integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q== dependencies: "@babel/code-frame" "^7.0.0" "@babel/parser" "^7.0.0" From 0a66ad56d949cc8596eb02901c305faad14ef3db Mon Sep 17 00:00:00 2001 From: senderfm Date: Tue, 18 Jun 2019 09:58:29 +0200 Subject: [PATCH 099/178] Fix Specs, lint, fix test --- .../comments/CommentList/CommentList.spec.js | 2 +- webapp/components/comments/CommentList/index.vue | 4 ++-- webapp/pages/post/_id.vue | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/webapp/components/comments/CommentList/CommentList.spec.js b/webapp/components/comments/CommentList/CommentList.spec.js index b15e4f7d6..503c0fe6d 100644 --- a/webapp/components/comments/CommentList/CommentList.spec.js +++ b/webapp/components/comments/CommentList/CommentList.spec.js @@ -86,7 +86,7 @@ describe('CommentList.vue', () => { }) it('displays comments when there are comments to display', () => { - expect(wrapper.find('div#comments').text()).toEqual('this is a comment') + expect(wrapper.find('div.comments').text()).toEqual('this is a comment') }) it("refetches a post's comments from the backend", () => { diff --git a/webapp/components/comments/CommentList/index.vue b/webapp/components/comments/CommentList/index.vue index c70c00c85..26118e745 100644 --- a/webapp/components/comments/CommentList/index.vue +++ b/webapp/components/comments/CommentList/index.vue @@ -1,5 +1,5 @@ diff --git a/webapp/pages/password-reset/request.vue b/webapp/pages/password-reset/request.vue new file mode 100644 index 000000000..7cf37f537 --- /dev/null +++ b/webapp/pages/password-reset/request.vue @@ -0,0 +1,18 @@ + + + diff --git a/webapp/pages/password-reset/verify-code.vue b/webapp/pages/password-reset/verify-code.vue new file mode 100644 index 000000000..e331c673c --- /dev/null +++ b/webapp/pages/password-reset/verify-code.vue @@ -0,0 +1,20 @@ + + + From 304fd028f0ccb1a49f2aecfb63bfe15e91ad7092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Tue, 18 Jun 2019 23:51:54 +0200 Subject: [PATCH 117/178] Leftover token=>code --- webapp/components/PasswordReset/VerifyCode.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/PasswordReset/VerifyCode.spec.js b/webapp/components/PasswordReset/VerifyCode.spec.js index cf12aacac..6f489e55f 100644 --- a/webapp/components/PasswordReset/VerifyCode.spec.js +++ b/webapp/components/PasswordReset/VerifyCode.spec.js @@ -65,7 +65,7 @@ describe('VerifyCode ', () => { it('delivers new password to backend', () => { const expected = expect.objectContaining({ - variables: { token: '123456', email: 'mail@example.org', newPassword: 'supersecret' }, + variables: { code: '123456', email: 'mail@example.org', newPassword: 'supersecret' }, }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) From a6a0ee16a00afce4ff3e2ae427d250365893e2ea Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Wed, 19 Jun 2019 04:19:09 +0000 Subject: [PATCH 118/178] Bump apollo-client from 2.6.2 to 2.6.3 in /webapp Bumps [apollo-client](https://github.com/apollographql/apollo-client) from 2.6.2 to 2.6.3. - [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.6.2...apollo-client@2.6.3) 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 a3d8c6dda..a06c53bd2 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -56,7 +56,7 @@ "@nuxtjs/style-resources": "~0.1.2", "accounting": "~0.4.1", "apollo-cache-inmemory": "~1.5.1", - "apollo-client": "~2.6.2", + "apollo-client": "~2.6.3", "cookie-universal-nuxt": "~2.0.16", "cross-env": "~5.2.0", "date-fns": "2.0.0-alpha.34", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 80d519770..4008c11f8 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -1893,10 +1893,10 @@ apollo-cache@1.3.2, apollo-cache@^1.2.1: apollo-utilities "^1.3.2" tslib "^1.9.3" -apollo-client@^2.5.1, apollo-client@~2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.2.tgz#03b6af651e09b6e413e486ddc87464c85bd6e514" - integrity sha512-oks1MaT5x7gHcPeC8vPC1UzzsKaEIC0tye+jg72eMDt5OKc7BobStTeS/o2Ib3e0ii40nKxGBnMdl/Xa/p56Yg== +apollo-client@^2.5.1, apollo-client@~2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.3.tgz#9bb2d42fb59f1572e51417f341c5f743798d22db" + integrity sha512-DS8pmF5CGiiJ658dG+mDn8pmCMMQIljKJSTeMNHnFuDLV0uAPZoeaAwVFiAmB408Ujqt92oIZ/8yJJAwSIhd4A== dependencies: "@types/zen-observable" "^0.8.0" apollo-cache "1.3.2" From 2e66c671c2cf086dbeab8d552b4d9ae75ab4c15f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Wed, 19 Jun 2019 04:20:14 +0000 Subject: [PATCH 119/178] Bump apollo-client from 2.6.2 to 2.6.3 in /backend Bumps [apollo-client](https://github.com/apollographql/apollo-client) from 2.6.2 to 2.6.3. - [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.6.2...apollo-client@2.6.3) Signed-off-by: dependabot-preview[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 ca6868036..1904cb71e 100644 --- a/backend/package.json +++ b/backend/package.json @@ -44,7 +44,7 @@ "dependencies": { "activitystrea.ms": "~2.1.3", "apollo-cache-inmemory": "~1.6.2", - "apollo-client": "~2.6.2", + "apollo-client": "~2.6.3", "apollo-link-context": "~1.0.18", "apollo-link-http": "~1.5.15", "apollo-server": "~2.6.3", diff --git a/backend/yarn.lock b/backend/yarn.lock index bc1e958ff..f0422d4ef 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1322,10 +1322,10 @@ apollo-cache@1.3.2, apollo-cache@^1.3.2: apollo-utilities "^1.3.2" tslib "^1.9.3" -apollo-client@~2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.2.tgz#03b6af651e09b6e413e486ddc87464c85bd6e514" - integrity sha512-oks1MaT5x7gHcPeC8vPC1UzzsKaEIC0tye+jg72eMDt5OKc7BobStTeS/o2Ib3e0ii40nKxGBnMdl/Xa/p56Yg== +apollo-client@~2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.3.tgz#9bb2d42fb59f1572e51417f341c5f743798d22db" + integrity sha512-DS8pmF5CGiiJ658dG+mDn8pmCMMQIljKJSTeMNHnFuDLV0uAPZoeaAwVFiAmB408Ujqt92oIZ/8yJJAwSIhd4A== dependencies: "@types/zen-observable" "^0.8.0" apollo-cache "1.3.2" From 65471efb0d19a4f9130ef6e4aa2ac168758db2bc Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 19 Jun 2019 13:08:51 +0200 Subject: [PATCH 120/178] removed fixImageUrls reference --- backend/src/middleware/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/middleware/index.js b/backend/src/middleware/index.js index aae2dcef3..9b85bd340 100644 --- a/backend/src/middleware/index.js +++ b/backend/src/middleware/index.js @@ -40,7 +40,6 @@ export default schema => { 'excerpt', 'notifications', 'xss', - 'fixImageUrls', 'softDelete', 'user', 'includedFields', From aa54433afb8292b1b6cfe9b6aa366ebe9e314870 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 19 Jun 2019 13:35:21 +0200 Subject: [PATCH 121/178] improved accuracy of import to reflect different types of contributions & follows. Cleaned neo4j import folder structure --- .../migration/mongo/export.sh | 16 +++++++++++--- .../migration/neo4j/{ => badges}/badges.cql | 0 .../{badges_delete.cql => badges/delete.cql} | 0 .../neo4j/{ => categories}/categories.cql | 0 .../delete.cql} | 0 .../neo4j/{ => comments}/comments.cql | 0 .../delete.cql} | 0 .../{ => contributions}/contributions.cql | 0 .../delete.cql} | 0 .../neo4j/{_delete_all.cql => delete_all.cql} | 0 .../delete.cql} | 0 .../neo4j/{ => emotions}/emotions.cql | 0 .../delete.cql} | 0 .../migration/neo4j/{ => follows}/follows.cql | 0 .../migration/neo4j/import.sh | 21 +++++++++++-------- .../delete.cql} | 0 .../migration/neo4j/{ => invites}/invites.cql | 0 .../delete.cql} | 0 .../{ => notifications}/notifications.cql | 0 .../delete.cql} | 0 .../{ => organizations}/organizations.cql | 0 .../{pages_delete.cql => pages/delete.cql} | 0 .../migration/neo4j/{ => pages}/pages.cql | 0 .../delete.cql} | 0 .../neo4j/{ => projects}/projects.cql | 0 .../delete.cql} | 0 .../neo4j/{ => settings}/settings.cql | 0 .../{shouts_delete.cql => shouts/delete.cql} | 0 .../migration/neo4j/{ => shouts}/shouts.cql | 0 .../{status_delete.cql => status/delete.cql} | 0 .../migration/neo4j/{ => status}/status.cql | 0 .../delete.cql} | 0 .../systemnotifications.cql | 0 .../{users_delete.cql => users/delete.cql} | 0 .../migration/neo4j/{ => users}/users.cql | 0 .../delete.cql} | 0 .../neo4j/{ => userscandos}/userscandos.cql | 0 .../delete.cql} | 0 .../neo4j/{ => usersettings}/usersettings.cql | 0 39 files changed, 25 insertions(+), 12 deletions(-) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => badges}/badges.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{badges_delete.cql => badges/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => categories}/categories.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{categories_delete.cql => categories/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => comments}/comments.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{comments_delete.cql => comments/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => contributions}/contributions.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{contributions_delete.cql => contributions/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{_delete_all.cql => delete_all.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{emotions_delete.cql => emotions/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => emotions}/emotions.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{follows_delete.cql => follows/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => follows}/follows.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{invites_delete.cql => invites/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => invites}/invites.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{notifications_delete.cql => notifications/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => notifications}/notifications.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{organizations_delete.cql => organizations/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => organizations}/organizations.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{pages_delete.cql => pages/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => pages}/pages.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{projects_delete.cql => projects/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => projects}/projects.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{settings_delete.cql => settings/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => settings}/settings.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{shouts_delete.cql => shouts/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => shouts}/shouts.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{status_delete.cql => status/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => status}/status.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{systemnotifications_delete.cql => systemnotifications/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => systemnotifications}/systemnotifications.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{users_delete.cql => users/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => users}/users.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{userscandos_delete.cql => userscandos/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => userscandos}/userscandos.cql (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{usersettings_delete.cql => usersettings/delete.cql} (100%) rename deployment/legacy-migration/maintenance-worker/migration/neo4j/{ => usersettings}/usersettings.cql (100%) diff --git a/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh b/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh index abed9b0f5..8d16f42fa 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh @@ -8,11 +8,18 @@ set +o allexport # Export collection function defintion function export_collection () { - "${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --collection $1 --out "${EXPORT_PATH}$1.json" + "${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --out "${EXPORT_PATH}$1.json" mkdir -p ${EXPORT_PATH}splits/$1/ split -l ${MONGO_EXPORT_SPLIT_SIZE} -a 3 ${EXPORT_PATH}$1.json ${EXPORT_PATH}splits/$1/ } +# Export collection with query function defintion +function export_collection_query () { + "${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --out "${EXPORT_PATH}$1_$3.json" --query "$2" + mkdir -p ${EXPORT_PATH}splits/$1_$3/ + split -l ${MONGO_EXPORT_SPLIT_SIZE} -a 3 ${EXPORT_PATH}$1_$3.json ${EXPORT_PATH}splits/$1_$3/ +} + # Delete old export & ensure directory rm -rf ${EXPORT_PATH}* mkdir -p ${EXPORT_PATH} @@ -24,9 +31,12 @@ ssh -4 -M -S my-ctrl-socket -fnNT -L 27018:localhost:27017 -l ${SSH_USERNAME} ${ export_collection "badges" export_collection "categories" export_collection "comments" -export_collection "contributions" +export_collection_query "contributions" "{'type': 'DELETED'}" "DELETED" +export_collection_query "contributions" "{'type': 'post'}" "post" +export_collection_query "contributions" "{'type': 'cando'}" "cando" export_collection "emotions" -export_collection "follows" +export_collection_query "follows" "{'foreignService': 'organizations'}" "organizations" +export_collection_query "follows" "{'foreignService': 'users'}" "users" export_collection "invites" export_collection "notifications" export_collection "organizations" diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/badges.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/badges.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/badges_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/categories.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/categories.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/categories_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/comments.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/comments.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/comments_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/_delete_all.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/delete_all.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/_delete_all.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/delete_all.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/emotions.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/emotions.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/follows_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/follows.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/follows.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh index ac256e3f0..23bd2e94c 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh @@ -10,7 +10,7 @@ set +o allexport function delete_collection () { # Delete from Database echo "Delete $1" - "${IMPORT_CYPHERSHELL_BIN}" < $(dirname "$0")/$1_delete.cql > /dev/null + "${IMPORT_CYPHERSHELL_BIN}" < $(dirname "$0")/$1/delete.cql > /dev/null # Delete index file rm -f "${IMPORT_PATH}splits/$1.index" } @@ -34,7 +34,7 @@ function import_collection () { # calculate the path of the chunk export IMPORT_CHUNK_PATH_CQL_FILE="${IMPORT_CHUNK_PATH_CQL}$1/${CHUNK_FILE_NAME}" # load the neo4j command and replace file variable with actual path - NEO4J_COMMAND="$(envsubst '${IMPORT_CHUNK_PATH_CQL_FILE}' < $(dirname "$0")/$1.cql)" + NEO4J_COMMAND="$(envsubst '${IMPORT_CHUNK_PATH_CQL_FILE}' < $(dirname "$0")/$2)" # run the import of the chunk echo "Import $1 ${CHUNK_FILE_NAME} (${chunk})" echo "${NEO4J_COMMAND}" | "${IMPORT_CYPHERSHELL_BIN}" > /dev/null @@ -75,13 +75,16 @@ echo "DONE" # Import Data echo "Start Importing Data" -import_collection "badges" -import_collection "categories" -import_collection "users" -import_collection "follows" -import_collection "contributions" -import_collection "shouts" -import_collection "comments" +import_collection "badges" "badges/badges.cql" +import_collection "categories" "categories/categories.cql" +import_collection "users" "users/users.cql" +import_collection "follows_users" "follows/follows.cql" +#import_collection "follows_organizations" "follows/follows.cql" +import_collection "contributions_post" "contributions/contributions.cql" +import_collection "contributions_cando" "contributions/contributions.cql" +#import_collection "contributions_DELETED" "contributions/contributions.cql" +import_collection "shouts" "shouts/shouts.cql" +import_collection "comments" "comments/comments.cql" # import_collection "emotions" # import_collection "invites" diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/invites_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/invites.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/invites.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/invites.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/notifications.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/notifications.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/organizations.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/organizations.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/pages_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/pages.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/pages.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/pages.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/projects_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/projects.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/projects.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/projects.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/settings_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/settings.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/settings.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/settings.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/shouts.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/shouts.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/status_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/status/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/status_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/status/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/status.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/status/status.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/status.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/status/status.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/systemnotifications.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/systemnotifications.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/users_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/userscandos.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/userscandos.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/usersettings.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/usersettings.cql From 7613ddfc04c2e3f8fd62fc954f1c6486e5fdaeff Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 19 Jun 2019 13:36:14 +0200 Subject: [PATCH 122/178] lint fixes --- backend/src/activitypub/NitroDataSource.js | 8 ++------ backend/src/middleware/notifications/spec.js | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/backend/src/activitypub/NitroDataSource.js b/backend/src/activitypub/NitroDataSource.js index eea37337a..0900bed6c 100644 --- a/backend/src/activitypub/NitroDataSource.js +++ b/backend/src/activitypub/NitroDataSource.js @@ -505,9 +505,7 @@ 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 } } @@ -519,9 +517,7 @@ 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 } } diff --git a/backend/src/middleware/notifications/spec.js b/backend/src/middleware/notifications/spec.js index 65212e544..985654b0f 100644 --- a/backend/src/middleware/notifications/spec.js +++ b/backend/src/middleware/notifications/spec.js @@ -87,9 +87,7 @@ describe('currentUser { notifications }', () => { 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 From a7eced5f8e26c866472fee73271f62a8f8d0ca74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 19 Jun 2019 13:40:08 +0200 Subject: [PATCH 123/178] Redirect to `/' if user is authenticated --- webapp/pages/password-reset.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index ca826524e..a781bd3fb 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -13,5 +13,10 @@ From 9cbb736d70ee6bc2789982cf99e931b76c736045 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 19 Jun 2019 13:54:20 +0200 Subject: [PATCH 124/178] cleanup import todo --- .../maintenance-worker/migration/neo4j/import.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh index 23bd2e94c..3b87601d2 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh @@ -91,13 +91,17 @@ import_collection "comments" "comments/comments.cql" # import_collection "notifications" # import_collection "organizations" # import_collection "pages" -# import_collection "projects" -# import_collection "settings" -# import_collection "status" # import_collection "systemnotifications" # import_collection "userscandos" # import_collection "usersettings" +# does only contain dummy data +# import_collection "projects" + +# does only contain alpha specifc data +# import_collection "status +# import_collection "settings"" + echo "DONE" echo "Time elapsed: $SECONDS seconds" From c85c94aa40c3d91a474f76d6908b84d232ce5b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 19 Jun 2019 14:07:35 +0200 Subject: [PATCH 125/178] Splitting components, better route navigation This also allows us to generate a password reset link to quickly reset your password without entering the code and email manually. --- .../PasswordReset/ChangePassword.spec.js | 83 +++++++++ .../PasswordReset/ChangePassword.vue | 140 +++++++++++++++ ...{PasswordReset.spec.js => Request.spec.js} | 6 +- .../{PasswordReset.vue => Request.vue} | 0 .../PasswordReset/VerifyCode.spec.js | 47 +----- .../components/PasswordReset/VerifyCode.vue | 159 +++--------------- .../pages/password-reset/change-password.vue | 28 +++ webapp/pages/password-reset/request.vue | 6 +- webapp/pages/password-reset/verify-code.vue | 8 +- 9 files changed, 282 insertions(+), 195 deletions(-) create mode 100644 webapp/components/PasswordReset/ChangePassword.spec.js create mode 100644 webapp/components/PasswordReset/ChangePassword.vue rename webapp/components/PasswordReset/{PasswordReset.spec.js => Request.spec.js} (94%) rename webapp/components/PasswordReset/{PasswordReset.vue => Request.vue} (100%) create mode 100644 webapp/pages/password-reset/change-password.vue diff --git a/webapp/components/PasswordReset/ChangePassword.spec.js b/webapp/components/PasswordReset/ChangePassword.spec.js new file mode 100644 index 000000000..88caa6c6d --- /dev/null +++ b/webapp/components/PasswordReset/ChangePassword.spec.js @@ -0,0 +1,83 @@ +import { mount, createLocalVue } from '@vue/test-utils' +import ChangePassword from './ChangePassword' +import Styleguide from '@human-connection/styleguide' + +const localVue = createLocalVue() + +localVue.use(Styleguide) + +describe('ChangePassword ', () => { + let wrapper + let Wrapper + let mocks + let propsData + + beforeEach(() => { + propsData = {} + mocks = { + $toast: { + success: jest.fn(), + error: jest.fn(), + }, + $t: jest.fn(), + $apollo: { + loading: false, + mutate: jest.fn().mockResolvedValue({ data: { resetPassword: true } }), + }, + } + }) + + describe('mount', () => { + beforeEach(jest.useFakeTimers) + + Wrapper = () => { + return mount(ChangePassword, { + mocks, + propsData, + localVue, + }) + } + + describe('given email and verification code', () => { + beforeEach(() => { + propsData.email = 'mail@example.org' + propsData.code = '123456' + }) + + describe('submitting new password', () => { + beforeEach(() => { + wrapper = Wrapper() + wrapper.find('input#newPassword').setValue('supersecret') + wrapper.find('input#confirmPassword').setValue('supersecret') + wrapper.find('form').trigger('submit') + }) + + it('calls resetPassword graphql mutation', () => { + expect(mocks.$apollo.mutate).toHaveBeenCalled() + }) + + it('delivers new password to backend', () => { + const expected = expect.objectContaining({ + variables: { code: '123456', email: 'mail@example.org', newPassword: 'supersecret' }, + }) + expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) + }) + + describe('password reset successful', () => { + it('displays success message', () => { + const expected = 'verify-code.form.change-password.success' + expect(mocks.$t).toHaveBeenCalledWith(expected) + }) + + describe('after animation', () => { + beforeEach(jest.runAllTimers) + + it('emits `change-password-sucess`', () => { + expect(wrapper.emitted('passwordResetResponse')).toEqual([['success']]) + }) + }) + }) + }) + }) + }) +}) diff --git a/webapp/components/PasswordReset/ChangePassword.vue b/webapp/components/PasswordReset/ChangePassword.vue new file mode 100644 index 000000000..5a12f9938 --- /dev/null +++ b/webapp/components/PasswordReset/ChangePassword.vue @@ -0,0 +1,140 @@ + + + diff --git a/webapp/components/PasswordReset/PasswordReset.spec.js b/webapp/components/PasswordReset/Request.spec.js similarity index 94% rename from webapp/components/PasswordReset/PasswordReset.spec.js rename to webapp/components/PasswordReset/Request.spec.js index 1adf68ee5..e7a1f6866 100644 --- a/webapp/components/PasswordReset/PasswordReset.spec.js +++ b/webapp/components/PasswordReset/Request.spec.js @@ -1,12 +1,12 @@ import { mount, createLocalVue } from '@vue/test-utils' -import PasswordReset from './PasswordReset' +import Request from './Request' import Styleguide from '@human-connection/styleguide' const localVue = createLocalVue() localVue.use(Styleguide) -describe('PasswordReset', () => { +describe('Request', () => { let wrapper let Wrapper let mocks @@ -29,7 +29,7 @@ describe('PasswordReset', () => { beforeEach(jest.useFakeTimers) Wrapper = () => { - return mount(PasswordReset, { + return mount(Request, { mocks, localVue, }) diff --git a/webapp/components/PasswordReset/PasswordReset.vue b/webapp/components/PasswordReset/Request.vue similarity index 100% rename from webapp/components/PasswordReset/PasswordReset.vue rename to webapp/components/PasswordReset/Request.vue diff --git a/webapp/components/PasswordReset/VerifyCode.spec.js b/webapp/components/PasswordReset/VerifyCode.spec.js index 6f489e55f..062e7e8f7 100644 --- a/webapp/components/PasswordReset/VerifyCode.spec.js +++ b/webapp/components/PasswordReset/VerifyCode.spec.js @@ -13,15 +13,7 @@ describe('VerifyCode ', () => { beforeEach(() => { mocks = { - $toast: { - success: jest.fn(), - error: jest.fn(), - }, $t: jest.fn(), - $apollo: { - loading: false, - mutate: jest.fn().mockResolvedValue({ data: { resetPassword: true } }), - }, } }) @@ -48,42 +40,9 @@ describe('VerifyCode ', () => { wrapper.find('form').trigger('submit') }) - it('displays a form to update your password', () => { - expect(wrapper.find('.change-password').exists()).toBe(true) - }) - - describe('submitting new password', () => { - beforeEach(() => { - wrapper.find('input#newPassword').setValue('supersecret') - wrapper.find('input#confirmPassword').setValue('supersecret') - wrapper.find('form').trigger('submit') - }) - - it('calls resetPassword graphql mutation', () => { - expect(mocks.$apollo.mutate).toHaveBeenCalled() - }) - - it('delivers new password to backend', () => { - const expected = expect.objectContaining({ - variables: { code: '123456', email: 'mail@example.org', newPassword: 'supersecret' }, - }) - expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) - }) - - describe('password reset successful', () => { - it('displays success message', () => { - const expected = 'verify-code.form.change-password.success' - expect(mocks.$t).toHaveBeenCalledWith(expected) - }) - - describe('after animation', () => { - beforeEach(jest.runAllTimers) - - it('emits `change-password-sucess`', () => { - expect(wrapper.emitted('passwordResetResponse')).toEqual([['success']]) - }) - }) - }) + it('emits `verifyCode`', () => { + const expected = [[{ code: '123456', email: 'mail@example.org' }]] + expect(wrapper.emitted('verification')).toEqual(expected) }) }) }) diff --git a/webapp/components/PasswordReset/VerifyCode.vue b/webapp/components/PasswordReset/VerifyCode.vue index d53d08bf2..410a027af 100644 --- a/webapp/components/PasswordReset/VerifyCode.vue +++ b/webapp/components/PasswordReset/VerifyCode.vue @@ -2,9 +2,8 @@ - diff --git a/webapp/pages/password-reset/request.vue b/webapp/pages/password-reset/request.vue index 7cf37f537..9148b4ed4 100644 --- a/webapp/pages/password-reset/request.vue +++ b/webapp/pages/password-reset/request.vue @@ -1,13 +1,13 @@