From e49892d69c5af288ebd3c1531e26806a1a43012d Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 6 Apr 2022 10:56:27 +0200 Subject: [PATCH 01/49] Changed the value of code so that it get's the configured COMMUNITY_URL and redeem/ from the backend. --- backend/src/graphql/model/TransactionLink.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/model/TransactionLink.ts b/backend/src/graphql/model/TransactionLink.ts index 5081ffd7d..7d91a22ac 100644 --- a/backend/src/graphql/model/TransactionLink.ts +++ b/backend/src/graphql/model/TransactionLink.ts @@ -2,7 +2,7 @@ import { ObjectType, Field, Int } from 'type-graphql' import Decimal from 'decimal.js-light' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' import { User } from './User' - +import CONFIG from '@/config' @ObjectType() export class TransactionLink { constructor(transactionLink: dbTransactionLink, user: User, redeemedBy: User | null = null) { @@ -11,7 +11,7 @@ export class TransactionLink { this.amount = transactionLink.amount this.holdAvailableAmount = transactionLink.holdAvailableAmount this.memo = transactionLink.memo - this.code = transactionLink.code + this.code = CONFIG.COMMUNITY_URL + 'redeem/' + transactionLink.code this.createdAt = transactionLink.createdAt this.validUntil = transactionLink.validUntil this.deletedAt = transactionLink.deletedAt From 54f5a0123f66500384ba4d983535fa0c7c603d33 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 6 Apr 2022 11:03:22 +0200 Subject: [PATCH 02/49] Remove the base url from the frontend. --- frontend/src/components/ClipboardCopy.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/ClipboardCopy.vue b/frontend/src/components/ClipboardCopy.vue index b952dbd8c..67461cb0f 100644 --- a/frontend/src/components/ClipboardCopy.vue +++ b/frontend/src/components/ClipboardCopy.vue @@ -18,7 +18,7 @@ export default { }, data() { return { - url: `${window.location.origin}/redeem/${this.code}`, + url: `${this.code}`, } }, methods: { From ff24798767d87a7adbbd75a027dbcdb1ed364796 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 6 Apr 2022 11:10:09 +0200 Subject: [PATCH 03/49] Add free line after import. --- backend/src/graphql/model/TransactionLink.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/graphql/model/TransactionLink.ts b/backend/src/graphql/model/TransactionLink.ts index 7d91a22ac..f0134470a 100644 --- a/backend/src/graphql/model/TransactionLink.ts +++ b/backend/src/graphql/model/TransactionLink.ts @@ -3,6 +3,7 @@ import Decimal from 'decimal.js-light' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' import { User } from './User' import CONFIG from '@/config' + @ObjectType() export class TransactionLink { constructor(transactionLink: dbTransactionLink, user: User, redeemedBy: User | null = null) { From d984ff25827aa84881dc7c74bd0b91fa2fb95e0a Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 6 Apr 2022 18:44:19 +0200 Subject: [PATCH 04/49] Add COMMUNITY_REDEEM_LINK to the config. --- backend/.env.dist | 1 + backend/.env.template | 1 + backend/src/config/index.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/backend/.env.dist b/backend/.env.dist index 0a95eda6c..2dc6f2b5f 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -27,6 +27,7 @@ KLICKTIPP_APIKEY_EN=SomeFakeKeyEN COMMUNITY_NAME=Gradido Entwicklung COMMUNITY_URL=http://localhost/ COMMUNITY_REGISTER_URL=http://localhost/register +COMMUNITY_REDEEM_URL=http://localhost/redeem/ COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido. # Login Server diff --git a/backend/.env.template b/backend/.env.template index 66cac7a7c..f9a5f3e32 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -26,6 +26,7 @@ KLICKTIPP_APIKEY_EN=$KLICKTIPP_APIKEY_EN COMMUNITY_NAME=$COMMUNITY_NAME COMMUNITY_URL=$COMMUNITY_URL COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL +COMMUNITY_REDEEM_URL=$COMMUNITY_REDEEM_URL COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION # Login Server diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 50388d29a..9c6e082c7 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -50,6 +50,7 @@ const community = { COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung', COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/', COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register', + COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/', COMMUNITY_DESCRIPTION: process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.', } From 41b35f2c5e6674e1c5922d0ac25efa287cfa7693 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 6 Apr 2022 18:45:27 +0200 Subject: [PATCH 05/49] Add link to the TransactionLink and change code by link in frontend. --- backend/src/graphql/model/TransactionLink.ts | 6 +++++- frontend/src/components/ClipboardCopy.vue | 4 ++-- frontend/src/components/GddSend/TransactionResultLink.vue | 4 ++-- .../src/components/TransactionLinks/TransactionLink.vue | 3 ++- frontend/src/graphql/mutations.js | 1 + frontend/src/graphql/queries.js | 1 + frontend/src/pages/Send.vue | 4 +++- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/backend/src/graphql/model/TransactionLink.ts b/backend/src/graphql/model/TransactionLink.ts index f0134470a..652545bbd 100644 --- a/backend/src/graphql/model/TransactionLink.ts +++ b/backend/src/graphql/model/TransactionLink.ts @@ -12,12 +12,13 @@ export class TransactionLink { this.amount = transactionLink.amount this.holdAvailableAmount = transactionLink.holdAvailableAmount this.memo = transactionLink.memo - this.code = CONFIG.COMMUNITY_URL + 'redeem/' + transactionLink.code + this.code = transactionLink.code this.createdAt = transactionLink.createdAt this.validUntil = transactionLink.validUntil this.deletedAt = transactionLink.deletedAt this.redeemedAt = transactionLink.redeemedAt this.redeemedBy = redeemedBy + this.link = CONFIG.COMMUNITY_REDEEM_URL + this.code } @Field(() => Number) @@ -52,6 +53,9 @@ export class TransactionLink { @Field(() => User, { nullable: true }) redeemedBy: User | null + + @Field(() => String) + link: string } @ObjectType() diff --git a/frontend/src/components/ClipboardCopy.vue b/frontend/src/components/ClipboardCopy.vue index 67461cb0f..ddc2cde8e 100644 --- a/frontend/src/components/ClipboardCopy.vue +++ b/frontend/src/components/ClipboardCopy.vue @@ -14,11 +14,11 @@ export default { name: 'ClipboardCopy', props: { - code: { type: String, required: true }, + link: { type: String, required: true }, }, data() { return { - url: `${this.code}`, + url: `${this.link}`, } }, methods: { diff --git a/frontend/src/components/GddSend/TransactionResultLink.vue b/frontend/src/components/GddSend/TransactionResultLink.vue index 66b5529d6..79369fc99 100644 --- a/frontend/src/components/GddSend/TransactionResultLink.vue +++ b/frontend/src/components/GddSend/TransactionResultLink.vue @@ -5,7 +5,7 @@
{{ $t('gdd_per_link.created') }}
- +

{{ $t('form.close') }} @@ -24,7 +24,7 @@ export default { ClipboardCopy, }, props: { - code: { + link: { type: String, required: true, }, diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index 9cbfdfb93..1c5ad690f 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -55,6 +55,7 @@ export default { props: { amount: { type: String, required: true }, code: { type: String, required: true }, + link: { type: String, required: true }, holdAvailableAmount: { type: String, required: true }, id: { type: Number, required: true }, memo: { type: String, required: true }, @@ -62,7 +63,7 @@ export default { }, methods: { copy() { - const link = `${window.location.origin}/redeem/${this.code}` + const link = `${this.link}` navigator.clipboard .writeText(link) .then(() => { diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index 3dbd8888e..754d8930a 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -76,6 +76,7 @@ export const createTransactionLink = gql` mutation($amount: Decimal!, $memo: String!) { createTransactionLink(amount: $amount, memo: $memo) { code + link } } ` diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index b8622ef2d..3452694d4 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -155,6 +155,7 @@ export const listTransactionLinks = gql` holdAvailableAmount memo code + link createdAt validUntil redeemedAt diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index 613342dba..533678a6e 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -41,7 +41,7 @@ >


@@ -88,6 +88,7 @@ export default { currentTransactionStep: TRANSACTION_STEPS.transactionForm, loading: false, code: null, + link: null, } }, props: { @@ -145,6 +146,7 @@ export default { .then((result) => { this.$emit('set-tunneled-email', null) this.code = result.data.createTransactionLink.code + this.link = result.data.createTransactionLink.link this.transactionData = { ...EMPTY_TRANSACTION_DATA } this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink this.updateTransactions({}) From 2cc7a6dee67e568e88a832b74ab647b08d6f0b34 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 6 Apr 2022 19:16:30 +0200 Subject: [PATCH 06/49] Fixing tests since we now use link and code. --- .../components/DecayInformations/CollapseLinksList.spec.js | 2 ++ .../src/components/TransactionLinks/TransactionLink.spec.js | 1 + .../components/Transactions/TransactionLinkSummary.spec.js | 4 ++++ frontend/src/pages/Send.spec.js | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/DecayInformations/CollapseLinksList.spec.js b/frontend/src/components/DecayInformations/CollapseLinksList.spec.js index b533c6aa1..b288f78d0 100644 --- a/frontend/src/components/DecayInformations/CollapseLinksList.spec.js +++ b/frontend/src/components/DecayInformations/CollapseLinksList.spec.js @@ -16,6 +16,7 @@ const propsData = { { amount: '5', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 87, @@ -26,6 +27,7 @@ const propsData = { { amount: '6', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 86, diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index f019a0ee1..8e455360b 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -22,6 +22,7 @@ const mocks = { const propsData = { amount: '75', code: 'c00000000c000000c0000', + link: 'http://localhost/redeem/c00000000c000000c0000', holdAvailableAmount: '5.13109484759482747111', id: 12, memo: 'Wie schön hier etwas Quatsch zu lesen!', diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js index 1f2a4388c..7dfd0d41b 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js +++ b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js @@ -44,6 +44,7 @@ describe('TransactionLinkSummary', () => { { amount: '75', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 86, @@ -55,6 +56,7 @@ describe('TransactionLinkSummary', () => { { amount: '85', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 107, @@ -65,6 +67,7 @@ describe('TransactionLinkSummary', () => { { amount: '95', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 92, @@ -76,6 +79,7 @@ describe('TransactionLinkSummary', () => { { amount: '150', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 16, diff --git a/frontend/src/pages/Send.spec.js b/frontend/src/pages/Send.spec.js index 447fdde33..148d62168 100644 --- a/frontend/src/pages/Send.spec.js +++ b/frontend/src/pages/Send.spec.js @@ -162,7 +162,7 @@ describe('Send', () => { describe('transaction form link', () => { beforeEach(async () => { apolloMutationMock.mockResolvedValue({ - data: { createTransactionLink: { code: '0123456789' } }, + data: { createTransactionLink: { code: '0123456789', link: 'http://localhost/redeem/0123456789' } }, }) const transactionForm = wrapper.findComponent({ name: 'TransactionForm' }) await transactionForm.findAll('input[type="radio"]').at(1).setChecked() From f6b9b7664cb8071d02525340ea6b2e6bcecd1c3e Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 7 Apr 2022 11:00:29 +0200 Subject: [PATCH 07/49] Add link to mocked return value. --- .../components/Transactions/TransactionLinkSummary.spec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js index 7dfd0d41b..1d3d70527 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js +++ b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js @@ -155,6 +155,7 @@ describe('TransactionLinkSummary', () => { { amount: '76', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 87, @@ -166,6 +167,7 @@ describe('TransactionLinkSummary', () => { { amount: '86', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 108, @@ -177,6 +179,7 @@ describe('TransactionLinkSummary', () => { { amount: '96', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 93, @@ -188,6 +191,7 @@ describe('TransactionLinkSummary', () => { { amount: '150', code: 'ce28664b5308c17f931c0367', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 17, From e4007849570aecb0dfe4becb6a5254e4b08fe1ed Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 7 Apr 2022 12:54:38 +0200 Subject: [PATCH 08/49] frontend config --- frontend/.env.dist | 21 ++++++++++++++++----- frontend/.env.template | 19 +++++++++++++++---- frontend/src/config/index.js | 21 +++++++++++++++------ 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/frontend/.env.dist b/frontend/.env.dist index df3c7cd7e..65d9ae305 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,5 +1,19 @@ -CONFIG_VERSION=v1.2022-03-18 +CONFIG_VERSION=v2.2022-04-07 +# Environment +DEFAULT_PUBLISHER_ID=2896 + +# Endpoints +GRAPHQL_URI=http://localhost/graphql +ADMIN_AUTH_URL=http://localhost/admin/authenticate?token={token} + +# Community +COMMUNITY_NAME=Gradido Entwicklung +COMMUNITY_URL=http://localhost/ +COMMUNITY_REGISTER_URL=http://localhost/register +COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido. + +# Meta META_URL=http://localhost META_TITLE_DE="Gradido – Dein Dankbarkeitskonto" META_TITLE_EN="Gradido - Your gratitude account" @@ -7,7 +21,4 @@ META_DESCRIPTION_DE="Dankbarkeit ist die Währung der neuen Zeit. Immer mehr Men META_DESCRIPTION_EN="Gratitude is the currency of the new age. More and more people are unleashing their potential and shaping a good future for all." META_KEYWORDS_DE="Grundeinkommen, Währung, Dankbarkeit, Schenk-Ökonomie, Natürliche Ökonomie des Lebens, Ökonomie, Ökologie, Potenzialentfaltung, Schenken und Danken, Kreislauf des Lebens, Geldsystem" META_KEYWORDS_EN="Basic Income, Currency, Gratitude, Gift Economy, Natural Economy of Life, Economy, Ecology, Potential Development, Giving and Thanking, Cycle of Life, Monetary System" -META_AUTHOR="Bernd Hückstädt - Gradido-Akademie" -GRAPHQL_URI=http://localhost/graphql -DEFAULT_PUBLISHER_ID=2896 -ADMIN_AUTH_URL=http://localhost/admin/authenticate?token={token} \ No newline at end of file +META_AUTHOR="Bernd Hückstädt - Gradido-Akademie" \ No newline at end of file diff --git a/frontend/.env.template b/frontend/.env.template index 10c42daa9..6d6b83fc7 100644 --- a/frontend/.env.template +++ b/frontend/.env.template @@ -1,5 +1,19 @@ CONFIG_VERSION=$FRONTEND_CONFIG_VERSION +# Environment +DEFAULT_PUBLISHER_ID=$DEFAULT_PUBLISHER_ID + +# Endpoints +GRAPHQL_URI=$GRAPHQL_URI +ADMIN_AUTH_URL=$ADMIN_AUTH_URL + +# Community +COMMUNITY_NAME=$COMMUNITY_NAME +COMMUNITY_URL=$COMMUNITY_URL +COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL +COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION + +# Meta META_URL=$META_URL META_TITLE_DE=$META_TITLE_DE META_TITLE_EN=$META_TITLE_EN @@ -7,7 +21,4 @@ META_DESCRIPTION_DE=$META_DESCRIPTION_DE META_DESCRIPTION_EN=$META_DESCRIPTION_EN META_KEYWORDS_DE=$META_KEYWORDS_DE META_KEYWORDS_EN=$META_KEYWORDS_EN -META_AUTHOR=$META_AUTHOR -GRAPHQL_URI=$GRAPHQL_URI -DEFAULT_PUBLISHER_ID=$DEFAULT_PUBLISHER_ID -ADMIN_AUTH_URL=$ADMIN_AUTH_URL \ No newline at end of file +META_AUTHOR=$META_AUTHOR \ No newline at end of file diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 3f62012ad..b3a971432 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -7,7 +7,7 @@ const pkg = require('../../package') const constants = { CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v1.2022-03-18', + EXPECTED: 'v2.2022-04-07', CURRENT: '', }, } @@ -27,6 +27,19 @@ const environment = { PORT: process.env.PORT || 3000, } +const endpoints = { + GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql', + ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token={token}', +} + +const community = { + COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung', + COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/', + COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register', + COMMUNITY_DESCRIPTION: + process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.', +} + const meta = { META_URL: process.env.META_URL || 'http://localhost', META_TITLE_DE: process.env.META_TITLE_DE || 'Gradido – Dein Dankbarkeitskonto', @@ -46,11 +59,6 @@ const meta = { META_AUTHOR: process.env.META_AUTHOR || 'Bernd Hückstädt - Gradido-Akademie', } -const endpoints = { - GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql', - ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token={token}', -} - // Check config version constants.CONFIG_VERSION.CURRENT = process.env.CONFIG_VERSION || constants.CONFIG_VERSION.DEFAULT if ( @@ -68,6 +76,7 @@ const CONFIG = { ...version, ...environment, ...endpoints, + ...community, ...meta, } From eaa8858bd3f9379b0548564616b88b5c53defa59 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 7 Apr 2022 12:54:58 +0200 Subject: [PATCH 09/49] deployment .env.dist --- deployment/bare_metal/.env.dist | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 8254fd9c2..bc6f7ca68 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -17,6 +17,12 @@ NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update- WEBHOOK_GITHUB_SECRET=secret WEBHOOK_GITHUB_BRANCH=master +# community +COMMUNITY_NAME="Gradido Development Stage1" +COMMUNITY_URL=https://stage1.gradido.net/ +COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register +COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" + # backend BACKEND_CONFIG_VERSION=v4.2022-04-05 @@ -31,11 +37,6 @@ KLICKTIPP_PASSWORD= KLICKTIPP_APIKEY_DE= KLICKTIPP_APIKEY_EN= -COMMUNITY_NAME="Gradido Development Stage1" -COMMUNITY_URL=https://stage1.gradido.net/ -COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register -COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" - EMAIL=true EMAIL_USERNAME=peter@lustig.de EMAIL_SENDER=peter@lustig.de @@ -53,7 +54,7 @@ WEBHOOK_ELOPAGE_SECRET=secret DATABASE_CONFIG_VERSION=v1.2022-03-18 # frontend -FRONTEND_CONFIG_VERSION=v1.2022-03-18 +FRONTEND_CONFIG_VERSION=v2.2022-04-07 GRAPHQL_URI=https://stage1.gradido.net/graphql ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token} From 751387ee3df594d924f6671c6e59702afe02bf9f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 7 Apr 2022 12:55:32 +0200 Subject: [PATCH 10/49] removed frontend community mixin & community query --- frontend/src/graphql/queries.js | 11 ----------- frontend/src/mixins/getCommunityInfo.js | 24 ------------------------ 2 files changed, 35 deletions(-) delete mode 100644 frontend/src/mixins/getCommunityInfo.js diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index b8622ef2d..1ffd30127 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -99,17 +99,6 @@ export const listGDTEntriesQuery = gql` } ` -export const communityInfo = gql` - query { - getCommunityInfo { - name - description - registerUrl - url - } - } -` - export const communities = gql` query { communities { diff --git a/frontend/src/mixins/getCommunityInfo.js b/frontend/src/mixins/getCommunityInfo.js deleted file mode 100644 index c6c021f9c..000000000 --- a/frontend/src/mixins/getCommunityInfo.js +++ /dev/null @@ -1,24 +0,0 @@ -import { communityInfo } from '../graphql/queries' - -export const getCommunityInfoMixin = { - methods: { - getCommunityInfo() { - if (this.$store.state.community.name === '') { - this.$apollo - .query({ - query: communityInfo, - }) - .then((result) => { - this.$store.commit('community', result.data.getCommunityInfo) - return result.data.getCommunityInfo - }) - .catch((error) => { - this.toastError(error.message) - }) - } - }, - }, - created() { - this.getCommunityInfo() - }, -} From ab3ff9cf4a97e59843a4e830f643f1fea59e178a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 7 Apr 2022 12:55:47 +0200 Subject: [PATCH 11/49] removed community from store --- frontend/src/store/store.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 458c8c8de..526a2c84f 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -38,9 +38,6 @@ export const mutations = { isAdmin: (state, isAdmin) => { state.isAdmin = !!isAdmin }, - community: (state, community) => { - state.community = community - }, coinanimation: (state, coinanimation) => { state.coinanimation = coinanimation }, @@ -96,10 +93,6 @@ try { isAdmin: false, coinanimation: true, newsletterState: null, - community: { - name: '', - description: '', - }, hasElopage: false, publisherId: null, }, From 5361cc9eb9407dfb6b9596a44e2b3d494bec6b58 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 7 Apr 2022 12:56:01 +0200 Subject: [PATCH 12/49] corrected correspondign pages --- frontend/src/pages/Login.spec.js | 32 +------- frontend/src/pages/Login.vue | 8 +- frontend/src/pages/Register.spec.js | 31 -------- frontend/src/pages/Register.vue | 8 +- frontend/src/pages/RegisterCommunity.spec.js | 33 --------- frontend/src/pages/RegisterCommunity.vue | 14 ++-- frontend/src/pages/SelectCommunity.spec.js | 78 +++++++------------- frontend/src/pages/SelectCommunity.vue | 10 +-- 8 files changed, 50 insertions(+), 164 deletions(-) diff --git a/frontend/src/pages/Login.spec.js b/frontend/src/pages/Login.spec.js index e26888d49..e506794b3 100644 --- a/frontend/src/pages/Login.spec.js +++ b/frontend/src/pages/Login.spec.js @@ -6,17 +6,7 @@ import { toastErrorSpy } from '@test/testSetup' const localVue = global.localVue -const apolloQueryMock = jest.fn().mockResolvedValue({ - data: { - getCommunityInfo: { - name: 'test12', - description: 'test community 12', - url: 'http://test12.test12/', - registerUrl: 'http://test12.test12/register', - }, - }, -}) - +const apolloQueryMock = jest.fn() const mockStoreDispach = jest.fn() const mockStoreCommit = jest.fn() const mockRouterPush = jest.fn() @@ -55,9 +45,6 @@ describe('Login', () => { $route: { params: {}, }, - $apollo: { - query: apolloQueryMock, - }, } const stubs = { @@ -86,19 +73,6 @@ describe('Login', () => { expect(wrapper.find('div.login-form').exists()).toBeTruthy() }) - describe('communities gives back error', () => { - beforeEach(() => { - apolloQueryMock.mockRejectedValue({ - message: 'Failed to get communities', - }) - wrapper = Wrapper() - }) - - it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('Failed to get communities') - }) - }) - describe('Login header', () => { it('has a welcome message', () => { expect(wrapper.find('div.header').text()).toBe('site.login.heading site.login.community') @@ -126,10 +100,6 @@ describe('Login', () => { 'Die lokale Entwicklungsumgebung von Gradido.', ) }) - - it('does not call community data update', () => { - expect(apolloQueryMock).not.toBeCalled() - }) }) describe('links', () => { diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index 79532cb21..f01332202 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -19,9 +19,9 @@
- {{ $store.state.community.name }} + {{ CONFIG.COMMUNITY_NAME }}

- {{ $store.state.community.description }} + {{ CONFIG.COMMUNITY_DESCRIPTION }}

{{ $t('login') }}
@@ -63,7 +63,7 @@ import InputPassword from '@/components/Inputs/InputPassword' import InputEmail from '@/components/Inputs/InputEmail' import { login } from '@/graphql/queries' -import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo' +import CONFIG from '@/config' export default { name: 'Login', @@ -71,7 +71,6 @@ export default { InputPassword, InputEmail, }, - mixins: [getCommunityInfoMixin], data() { return { form: { @@ -79,6 +78,7 @@ export default { password: '', }, passwordVisible: false, + CONFIG, } }, methods: { diff --git a/frontend/src/pages/Register.spec.js b/frontend/src/pages/Register.spec.js index 446c97928..b4f518d3c 100644 --- a/frontend/src/pages/Register.spec.js +++ b/frontend/src/pages/Register.spec.js @@ -2,21 +2,8 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import flushPromises from 'flush-promises' import Register from './Register' -import { toastErrorSpy } from '@test/testSetup' - const localVue = global.localVue -const apolloQueryMock = jest.fn().mockResolvedValue({ - data: { - getCommunityInfo: { - name: 'test12', - description: 'test community 12', - url: 'http://test12.test12/', - registerUrl: 'http://test12.test12/register', - }, - }, -}) - const mockStoreCommit = jest.fn() const registerUserMutationMock = jest.fn() const routerPushMock = jest.fn() @@ -37,7 +24,6 @@ describe('Register', () => { }, $apollo: { mutate: registerUserMutationMock, - query: apolloQueryMock, }, $store: { commit: mockStoreCommit, @@ -85,19 +71,6 @@ describe('Register', () => { }) }) - describe('communities gives back error', () => { - beforeEach(() => { - apolloQueryMock.mockRejectedValue({ - message: 'Failed to get communities', - }) - wrapper = Wrapper() - }) - - it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('Failed to get communities') - }) - }) - describe('Community data already loaded', () => { beforeEach(() => { jest.clearAllMocks() @@ -119,10 +92,6 @@ describe('Register', () => { 'Die lokale Entwicklungsumgebung von Gradido.', ) }) - - it('does not call community data update', () => { - expect(apolloQueryMock).not.toBeCalled() - }) }) describe('links', () => { diff --git a/frontend/src/pages/Register.vue b/frontend/src/pages/Register.vue index cadc0f34c..94441c636 100755 --- a/frontend/src/pages/Register.vue +++ b/frontend/src/pages/Register.vue @@ -23,9 +23,9 @@
- {{ $store.state.community.name }} + {{ CONFIG.COMMUNITY_NAME }}

- {{ $store.state.community.description }} + {{ CONFIG.COMMUNITY_DESCRIPTION }}

{{ $t('signup') }}
@@ -192,12 +192,11 @@ import InputEmail from '@/components/Inputs/InputEmail.vue' import LanguageSwitchSelect from '@/components/LanguageSwitchSelect.vue' import { createUser } from '@/graphql/mutations' -import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo' +import CONFIG from '@/config' export default { components: { InputEmail, LanguageSwitchSelect }, name: 'Register', - mixins: [getCommunityInfoMixin], data() { return { form: { @@ -213,6 +212,7 @@ export default { register: true, publisherId: this.$store.state.publisherId, redeemCode: this.$route.params.code, + CONFIG, } }, methods: { diff --git a/frontend/src/pages/RegisterCommunity.spec.js b/frontend/src/pages/RegisterCommunity.spec.js index deb1d999d..76890f877 100644 --- a/frontend/src/pages/RegisterCommunity.spec.js +++ b/frontend/src/pages/RegisterCommunity.spec.js @@ -1,21 +1,8 @@ import { mount, RouterLinkStub } from '@vue/test-utils' import RegisterCommunity from './RegisterCommunity' -import { toastErrorSpy } from '@test/testSetup' - const localVue = global.localVue -const apolloQueryMock = jest.fn().mockResolvedValue({ - data: { - getCommunityInfo: { - name: 'test12', - description: 'test community 12', - url: 'http://test12.test12/', - registerUrl: 'http://test12.test12/register', - }, - }, -}) - const mockStoreCommit = jest.fn() describe('RegisterCommunity', () => { @@ -26,9 +13,6 @@ describe('RegisterCommunity', () => { locale: 'en', }, $t: jest.fn((t) => t), - $apollo: { - query: apolloQueryMock, - }, $store: { commit: mockStoreCommit, state: { @@ -66,19 +50,6 @@ describe('RegisterCommunity', () => { expect(wrapper.find('div#register-community').exists()).toBeTruthy() }) - describe('communities gives back error', () => { - beforeEach(() => { - apolloQueryMock.mockRejectedValue({ - message: 'Failed to get communities', - }) - wrapper = Wrapper() - }) - - it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('Failed to get communities') - }) - }) - describe('Community data already loaded', () => { beforeEach(() => { jest.clearAllMocks() @@ -100,10 +71,6 @@ describe('RegisterCommunity', () => { 'Die lokale Entwicklungsumgebung von Gradido.', ) }) - - it('does not call community data update', () => { - expect(apolloQueryMock).not.toBeCalled() - }) }) describe('buttons and links', () => { diff --git a/frontend/src/pages/RegisterCommunity.vue b/frontend/src/pages/RegisterCommunity.vue index 736a4282f..1acc0827e 100644 --- a/frontend/src/pages/RegisterCommunity.vue +++ b/frontend/src/pages/RegisterCommunity.vue @@ -6,12 +6,12 @@
-

{{ $store.state.community.name }}

+

{{ CONFIG.COMMUNITY_NAME }}

- {{ $store.state.community.description }} + {{ CONFIG.COMMUNITY_DESCRIPTION }}

- {{ $store.state.community.url }} + {{ CONFIG.COMMUNITY_URL }}

@@ -49,10 +49,14 @@
diff --git a/frontend/src/pages/SelectCommunity.spec.js b/frontend/src/pages/SelectCommunity.spec.js index f8896ae15..25ec8db93 100644 --- a/frontend/src/pages/SelectCommunity.spec.js +++ b/frontend/src/pages/SelectCommunity.spec.js @@ -1,5 +1,5 @@ import { mount, RouterLinkStub } from '@vue/test-utils' -import { communities, communityInfo } from '@/graphql/queries' +import { communities } from '@/graphql/queries' import SelectCommunity from './SelectCommunity' import { toastErrorSpy } from '@test/testSetup' @@ -14,45 +14,33 @@ const spinnerMock = jest.fn(() => { } }) -const apolloQueryMock = jest - .fn() - .mockResolvedValueOnce({ - data: { - getCommunityInfo: { - name: 'test12', - description: 'test community 12', - url: 'http://test12.test12/', - registerUrl: 'http://test12.test12/register', +const apolloQueryMock = jest.fn().mockResolvedValue({ + data: { + communities: [ + { + id: 1, + name: 'Gradido Entwicklung', + description: 'Die lokale Entwicklungsumgebung von Gradido.', + url: 'http://localhost/', + registerUrl: 'http://localhost/register-community', }, - }, - }) - .mockResolvedValue({ - data: { - communities: [ - { - id: 1, - name: 'Gradido Entwicklung', - description: 'Die lokale Entwicklungsumgebung von Gradido.', - url: 'http://localhost/', - registerUrl: 'http://localhost/register-community', - }, - { - id: 2, - name: 'Gradido Staging', - description: 'Der Testserver der Gradido-Akademie.', - url: 'https://stage1.gradido.net/', - registerUrl: 'https://stage1.gradido.net/register-community', - }, - { - id: 3, - name: 'Gradido-Akademie', - description: 'Freies Institut für Wirtschaftsbionik.', - url: 'https://gradido.net', - registerUrl: 'https://gdd1.gradido.com/register-community', - }, - ], - }, - }) + { + id: 2, + name: 'Gradido Staging', + description: 'Der Testserver der Gradido-Akademie.', + url: 'https://stage1.gradido.net/', + registerUrl: 'https://stage1.gradido.net/register-community', + }, + { + id: 3, + name: 'Gradido-Akademie', + description: 'Freies Institut für Wirtschaftsbionik.', + url: 'https://gradido.net', + registerUrl: 'https://gdd1.gradido.com/register-community', + }, + ], + }, +}) const mockStoreCommit = jest.fn() @@ -95,12 +83,6 @@ describe('SelectCommunity', () => { wrapper = Wrapper() }) - it('calls the API to get the community info data', () => { - expect(apolloQueryMock).toBeCalledWith({ - query: communityInfo, - }) - }) - it('calls the API to get the communities data', () => { expect(apolloQueryMock).toBeCalledWith({ query: communities, @@ -141,12 +123,6 @@ describe('SelectCommunity', () => { wrapper = Wrapper() }) - it('does not call community info data when already filled', () => { - expect(apolloQueryMock).not.toBeCalledWith({ - query: communityInfo, - }) - }) - it('has a Community name', () => { expect(wrapper.find('.card-body b').text()).toBe('Gradido Entwicklung') }) diff --git a/frontend/src/pages/SelectCommunity.vue b/frontend/src/pages/SelectCommunity.vue index 0535e4fe7..8702d3e2e 100644 --- a/frontend/src/pages/SelectCommunity.vue +++ b/frontend/src/pages/SelectCommunity.vue @@ -5,9 +5,9 @@
- {{ $store.state.community.name }} + {{ CONFIG.COMMUNITY_NAME }}
-

{{ $store.state.community.description }}

+

{{ CONFIG.COMMUNITY_DESCRIPTION }}


@@ -49,7 +49,7 @@ From 0b53cfa04400cae3fdef684f3feba3723a809e45 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 20 Apr 2022 09:15:08 +0200 Subject: [PATCH 33/49] update test --- .../TransactionLinkSummary.spec.js | 191 ++++++++++-------- .../Transactions/TransactionLinkSummary.vue | 2 +- 2 files changed, 107 insertions(+), 86 deletions(-) diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js index 078ce6f97..3e57bceeb 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js +++ b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js @@ -100,18 +100,113 @@ describe('TransactionLinkSummary', () => { expect(wrapper.findComponent({ name: 'CollapseLinksList' }).exists()).toBe(true) }) - it('calls the API to get the list transaction links', () => { - expect(apolloQueryMock).toBeCalledWith({ - query: listTransactionLinks, - variables: { - currentPage: 1, - }, - fetchPolicy: 'network-only', + describe('click on transaction links', () => { + beforeEach(() => { + wrapper.find('div.transaction-link-details').trigger('click') }) - }) - it('has four transactionLinks', () => { - expect(wrapper.vm.transactionLinks).toHaveLength(4) + it('calls the API to get the list transaction links', () => { + expect(apolloQueryMock).toBeCalledWith({ + query: listTransactionLinks, + variables: { + currentPage: 1, + }, + fetchPolicy: 'network-only', + }) + }) + + it('has four transactionLinks', () => { + expect(wrapper.vm.transactionLinks).toHaveLength(4) + }) + + describe('close transaction link details', () => { + beforeEach(() => { + jest.clearAllMocks() + wrapper.find('div.transaction-link-details').trigger('click') + }) + + it('does not call the API', () => { + expect(apolloQueryMock).not.toBeCalled() + }) + + it('has no component CollapseLinksList', () => { + expect(wrapper.findComponent({ name: 'CollapseLinksList' }).isVisible()).toBe(false) + }) + }) + + describe('load more transaction links', () => { + beforeEach(async () => { + jest.clearAllMocks() + apolloQueryMock.mockResolvedValue({ + data: { + listTransactionLinks: [ + { + amount: '76', + code: 'ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 87, + memo: + 'Hat jemand die Nummer von der Hexe aus Schneewittchen? Ich bräuchte mal ein paar Äpfel.', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '86', + code: 'ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 108, + memo: + 'Die Windfahn´ krächzt am Dach, Der Uhu im Geklüfte; Was wispert wie ein Ach Verhallend in die Lüfte?', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '96', + code: 'ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 93, + memo: + 'Verschlafen kräht der Hahn, Ein Blitz noch, und ein trüber, Umwölbter Tag bricht an – Walpurgisnacht vorüber!', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '150', + code: 'ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 17, + memo: 'Eene meene Flaschenschrank, fertig ist der Hexentrank!', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + ], + }, + }) + await wrapper.setData({ + currentPage: 2, + pending: false, + pageSize: 5, + }) + }) + + it('has eight transactionLinks', () => { + expect(wrapper.vm.transactionLinks).toHaveLength(8) + }) + + it('loads more transaction links', () => { + expect(apolloQueryMock).toBeCalledWith({ + query: listTransactionLinks, + variables: { + currentPage: 2, + }, + fetchPolicy: 'network-only', + }) + }) + }) }) describe('reset transaction links', () => { @@ -143,84 +238,10 @@ describe('TransactionLinkSummary', () => { }) }) - describe('load more transaction links', () => { - beforeEach(async () => { - jest.clearAllMocks() - apolloQueryMock.mockResolvedValue({ - data: { - listTransactionLinks: [ - { - amount: '76', - code: 'ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 87, - memo: - 'Hat jemand die Nummer von der Hexe aus Schneewittchen? Ich bräuchte mal ein paar Äpfel.', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '86', - code: 'ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 108, - memo: - 'Die Windfahn´ krächzt am Dach, Der Uhu im Geklüfte; Was wispert wie ein Ach Verhallend in die Lüfte?', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '96', - code: 'ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 93, - memo: - 'Verschlafen kräht der Hahn, Ein Blitz noch, und ein trüber, Umwölbter Tag bricht an – Walpurgisnacht vorüber!', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '150', - code: 'ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 17, - memo: 'Eene meene Flaschenschrank, fertig ist der Hexentrank!', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - ], - }, - }) - await wrapper.setData({ - currentPage: 2, - pending: false, - pageSize: 5, - }) - }) - - it('has eight transactionLinks', () => { - expect(wrapper.vm.transactionLinks).toHaveLength(8) - }) - - it('loads more transaction links', () => { - expect(apolloQueryMock).toBeCalledWith({ - query: listTransactionLinks, - variables: { - currentPage: 2, - }, - fetchPolicy: 'network-only', - }) - }) - }) - describe('loads transaction links with error', () => { beforeEach(() => { apolloQueryMock.mockRejectedValue({ message: 'OUCH!' }) - wrapper = Wrapper() + wrapper.find('div.transaction-link-details').trigger('click') }) it('toasts an error message', () => { diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.vue b/frontend/src/components/Transactions/TransactionLinkSummary.vue index 16a623a92..84d0f9b84 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.vue +++ b/frontend/src/components/Transactions/TransactionLinkSummary.vue @@ -1,7 +1,7 @@