From 2fb5cf2d81b0f3388197128fac46138b4207a790 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 10:27:14 +0100 Subject: [PATCH 01/32] delete redeemCode from store --- frontend/src/store/store.js | 5 ----- frontend/src/store/store.test.js | 11 +---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index fb74624fb..458c8c8de 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -47,9 +47,6 @@ export const mutations = { hasElopage: (state, hasElopage) => { state.hasElopage = hasElopage }, - redeemCode: (state, redeemCode) => { - state.redeemCode = redeemCode - }, } export const actions = { @@ -76,7 +73,6 @@ export const actions = { commit('hasElopage', false) commit('publisherId', null) commit('isAdmin', false) - commit('redeemCode', null) localStorage.clear() }, } @@ -106,7 +102,6 @@ try { }, hasElopage: false, publisherId: null, - redeemCode: null, }, getters: {}, // Syncronous mutation of the state diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js index 29a703e8f..ea40d9474 100644 --- a/frontend/src/store/store.test.js +++ b/frontend/src/store/store.test.js @@ -26,7 +26,6 @@ const { isAdmin, community, hasElopage, - redeemCode, } = mutations const { login, logout } = actions @@ -142,14 +141,6 @@ describe('Vuex store', () => { hasElopage(state, true) expect(state.hasElopage).toBeTruthy() }) - - describe('redeemCode', () => { - it('sets the state of token', () => { - const state = { redeemCode: null } - redeemCode(state, 'a0000b0000c0000') - expect(state.redeemCode).toEqual('a0000b0000c0000') - }) - }) }) }) @@ -228,7 +219,7 @@ describe('Vuex store', () => { it('calls nine commits', () => { logout({ commit, state }) - expect(commit).toHaveBeenCalledTimes(10) + expect(commit).toHaveBeenCalledTimes(9) }) it('commits token', () => { From 6c87a6f32a05b98ca081e6d9d00704b766b45413 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 10:28:12 +0100 Subject: [PATCH 02/32] changed code from store to param --- frontend/src/pages/Register.vue | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/frontend/src/pages/Register.vue b/frontend/src/pages/Register.vue index b2df16e0f..4ffe92512 100755 --- a/frontend/src/pages/Register.vue +++ b/frontend/src/pages/Register.vue @@ -118,7 +118,7 @@ {{ messageError }} - +
@@ -130,7 +130,7 @@ readonly id="redeem-code" type="text" - v-model="$store.state.redeemCode" + v-model="redeemCode" >
@@ -234,7 +234,7 @@ export default { messageError: '', register: true, publisherId: this.$store.state.publisherId, - redeemCode: this.$store.state.redeemCode, + redeemCode: this.$route.params.code, } }, methods: { @@ -248,9 +248,6 @@ export default { commitStorePublisherId(val) { this.$store.commit('publisherId', val) }, - commitStoreRedeemCode(val) { - this.$store.commit('redeemCode', val) - }, async onSubmit() { this.$apollo .mutate({ @@ -261,7 +258,7 @@ export default { lastName: this.form.lastname, language: this.language, publisherId: this.$store.state.publisherId, - redeemCode: this.$store.state.redeemCode, + redeemCode: this.redeemCode, }, }) .then(() => { @@ -296,10 +293,5 @@ export default { return !(this.namesFilled && this.emailFilled && this.form.agree && !!this.language) }, }, - created() { - if (this.$route.params.code) { - this.commitStoreRedeemCode(this.$route.params.code) - } - }, } From 1f1cd67b9e76824613993fa850e9a9076559f60a Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 10:29:13 +0100 Subject: [PATCH 03/32] add redeemCode --- backend/src/graphql/arg/CreateUserArgs.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/graphql/arg/CreateUserArgs.ts b/backend/src/graphql/arg/CreateUserArgs.ts index 0d63e76bb..59462aa2a 100644 --- a/backend/src/graphql/arg/CreateUserArgs.ts +++ b/backend/src/graphql/arg/CreateUserArgs.ts @@ -16,4 +16,7 @@ export default class CreateUserArgs { @Field(() => Int, { nullable: true }) publisherId: number + + @Field(() => String, { nullable: true }) + redeemCode: string } From 3992882962fedb69714d651aecffbf1fc0548bd8 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 10:29:56 +0100 Subject: [PATCH 04/32] add redeemCode on UserResolver.ts --- backend/src/graphql/resolver/UserResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 04c5fdf63..4ee564977 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -313,7 +313,7 @@ export class UserResolver { @Authorized([RIGHTS.CREATE_USER]) @Mutation(() => User) async createUser( - @Args() { email, firstName, lastName, language, publisherId }: CreateUserArgs, + @Args() { email, firstName, lastName, language, publisherId, redeemCode }: CreateUserArgs, ): Promise { // TODO: wrong default value (should be null), how does graphql work here? Is it an required field? // default int publisher_id = 0; From 15e0186381522fb60a8d9efe0852353f46eff643 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 10:54:56 +0100 Subject: [PATCH 05/32] add redeemCode on register process for createUser --- backend/src/graphql/resolver/UserResolver.ts | 10 +++++++--- backend/src/seeds/graphql/mutations.ts | 2 ++ backend/src/webhook/elopage.ts | 1 + frontend/src/graphql/mutations.js | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 4ee564977..80e927da7 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -367,11 +367,15 @@ export class UserResolver { // TODO: this has duplicate code with sendResetPasswordEmail const emailOptIn = await createEmailOptIn(dbUser.id, queryRunner) - const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( + let activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( /{code}/g, emailOptIn.verificationCode.toString(), ) + if (redeemCode !== '') { + activationLink += '/' + redeemCode + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const emailSent = await sendAccountActivationEmail({ link: activationLink, @@ -380,13 +384,13 @@ export class UserResolver { email, }) - /* uncomment this, when you need the activation link on the console + // uncomment this, when you need the activation link on the console // In case EMails are disabled log the activation link for the user if (!emailSent) { // eslint-disable-next-line no-console console.log(`Account confirmation link: ${activationLink}`) } - */ + await queryRunner.commitTransaction() } catch (e) { await queryRunner.rollbackTransaction() diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index 19ca2a8d0..cab864c4e 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -45,6 +45,7 @@ export const createUser = gql` $email: String! $language: String! $publisherId: Int + $redeemCode: String ) { createUser( email: $email @@ -52,6 +53,7 @@ export const createUser = gql` lastName: $lastName language: $language publisherId: $publisherId + redeemCode: $redeemCode ) { id } diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index d5eaef521..ee8c3fc94 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -140,6 +140,7 @@ export const elopageWebhook = async (req: any, res: any): Promise => { firstName, lastName, publisherId: loginElopageBuy.publisherId || 0, // This seemed to be the default value if not set + redeemCode: '', }) } catch (error) { // eslint-disable-next-line no-console diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index d3a177866..95c811f8d 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -45,6 +45,7 @@ export const createUser = gql` $email: String! $language: String! $publisherId: Int + $redeemCode: String ) { createUser( email: $email @@ -52,6 +53,7 @@ export const createUser = gql` lastName: $lastName language: $language publisherId: $publisherId + redeemCode: $redeemCode ) { id } From a23777b6ec5dccfd5e11b1a8e29b5c329c9747da Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 12:07:59 +0100 Subject: [PATCH 06/32] uncomment code activationLink --- backend/src/graphql/resolver/UserResolver.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 80e927da7..311916aad 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -384,12 +384,13 @@ export class UserResolver { email, }) - // uncomment this, when you need the activation link on the console + /* uncomment this, when you need the activation link on the console // In case EMails are disabled log the activation link for the user if (!emailSent) { // eslint-disable-next-line no-console console.log(`Account confirmation link: ${activationLink}`) } + */ await queryRunner.commitTransaction() } catch (e) { From cdd13cf24e890760563ff043f483ab13bc61ae8d Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 12:09:07 +0100 Subject: [PATCH 07/32] add params on thx and checkEmail --- frontend/src/routes/routes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 5e0b09c5e..a6586c201 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -47,7 +47,7 @@ const routes = [ component: () => import('@/pages/Register.vue'), }, { - path: '/thx/:comingFrom', + path: '/thx/:comingFrom/:code?', component: () => import('@/pages/thx.vue'), beforeEnter: (to, from, next) => { const validFrom = ['forgot-password', 'reset-password', 'register', 'login', 'checkEmail'] @@ -79,7 +79,7 @@ const routes = [ component: () => import('@/pages/ResetPassword.vue'), }, { - path: '/checkEmail/:optin', + path: '/checkEmail/:optin/:code?', component: () => import('@/pages/ResetPassword.vue'), }, { From 6d257825e2aee4e5f9710c9e7c73666d2bdeed67 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 12:11:19 +0100 Subject: [PATCH 08/32] add redeemCode to login button --- frontend/src/pages/thx.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/thx.vue b/frontend/src/pages/thx.vue index 41c63c7d8..308c354fa 100644 --- a/frontend/src/pages/thx.vue +++ b/frontend/src/pages/thx.vue @@ -9,7 +9,11 @@

{{ $t(displaySetup.subtitle) }}


- + + + {{ $t(displaySetup.button) }} + + {{ $t(displaySetup.button) }} @@ -65,6 +69,11 @@ export default { this.displaySetup = textFields[this.$route.params.comingFrom] }, }, + computed: { + redeemLoginLink() { + return this.$route.params.code ? '/login/' + this.$route.params.code : '/login' + }, + }, created() { this.setDisplaySetup() }, From 042741a9aab75f05b0f74857d53ed9b658ee8d67 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 12:11:59 +0100 Subject: [PATCH 09/32] add code to push --- frontend/src/pages/ResetPassword.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/ResetPassword.vue b/frontend/src/pages/ResetPassword.vue index b0194c0ba..b6de8cb97 100644 --- a/frontend/src/pages/ResetPassword.vue +++ b/frontend/src/pages/ResetPassword.vue @@ -96,7 +96,11 @@ export default { .then(() => { this.form.password = '' if (this.$route.path.includes('checkEmail')) { - this.$router.push('/thx/checkEmail') + if (this.$route.params.code) { + this.$router.push('/thx/checkEmail/' + this.$route.params.code) + } else { + this.$router.push('/thx/checkEmail') + } } else { this.$router.push('/thx/resetPassword') } From f8882fa63a8f052b96188bf36874542cd1d7de76 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 14:41:50 +0100 Subject: [PATCH 10/32] remove computed --- frontend/src/pages/thx.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/frontend/src/pages/thx.vue b/frontend/src/pages/thx.vue index 308c354fa..ee6338d26 100644 --- a/frontend/src/pages/thx.vue +++ b/frontend/src/pages/thx.vue @@ -9,7 +9,7 @@

{{ $t(displaySetup.subtitle) }}


- + {{ $t(displaySetup.button) }} @@ -69,11 +69,6 @@ export default { this.displaySetup = textFields[this.$route.params.comingFrom] }, }, - computed: { - redeemLoginLink() { - return this.$route.params.code ? '/login/' + this.$route.params.code : '/login' - }, - }, created() { this.setDisplaySetup() }, From 2b7d9d8c1a987eed7164692157fe9fdc94946831 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 21 Mar 2022 17:23:56 +0100 Subject: [PATCH 11/32] save referrer ID when present on register --- backend/src/graphql/resolver/UserResolver.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 33fba47a2..3b3ef394c 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -7,6 +7,7 @@ import { getConnection, getCustomRepository, QueryRunner } from '@dbTools/typeor import CONFIG from '@/config' import { User } from '@model/User' import { User as DbUser } from '@entity/User' +import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' import { encode } from '@/auth/JWT' import CreateUserArgs from '@arg/CreateUserArgs' import UnsecureLoginArgs from '@arg/UnsecureLoginArgs' @@ -338,6 +339,12 @@ export class UserResolver { dbUser.language = language dbUser.publisherId = publisherId dbUser.passphrase = passphrase.join(' ') + if (redeemCode) { + const transactionLink = await dbTransactionLink.findOne({ code: redeemCode }) + if (transactionLink) { + dbUser.referrerId = transactionLink.userId + } + } // TODO this field has no null allowed unlike the loginServer table // dbUser.pubKey = Buffer.from(randomBytes(32)) // Buffer.alloc(32, 0) default to 0000... // dbUser.pubkey = keyPair[0] From 4675c5679068abafde0e51bdb2252a57a6cbcc1b Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 21 Mar 2022 21:38:28 +0100 Subject: [PATCH 12/32] test router.test.js fixed --- frontend/src/routes/router.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/router.test.js b/frontend/src/routes/router.test.js index 85f765c69..925b3ffca 100644 --- a/frontend/src/routes/router.test.js +++ b/frontend/src/routes/router.test.js @@ -112,7 +112,7 @@ describe('router', () => { }) describe('thx', () => { - const thx = routes.find((r) => r.path === '/thx/:comingFrom') + const thx = routes.find((r) => r.path === '/thx/:comingFrom/:code?') it('loads the "Thx" page', async () => { const component = await thx.component() @@ -177,7 +177,9 @@ describe('router', () => { describe('checkEmail', () => { it('loads the "CheckEmail" page', async () => { - const component = await routes.find((r) => r.path === '/checkEmail/:optin').component() + const component = await routes + .find((r) => r.path === '/checkEmail/:optin/:code?') + .component() expect(component.default.name).toBe('ResetPassword') }) }) From 8a2ca07b2edabd8ca7c432dfb8f07f9408b689db Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 22 Mar 2022 07:09:58 +0100 Subject: [PATCH 13/32] test UserResolver.test.js ok, with redeemCode --- backend/src/graphql/resolver/UserResolver.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index f873fd694..a982f3768 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -54,6 +54,7 @@ describe('UserResolver', () => { lastName: 'Lustig', language: 'de', publisherId: 1234, + redeemCode: 'a0000b0000c0000', } let result: any @@ -126,7 +127,7 @@ describe('UserResolver', () => { it('sends an account activation email', () => { const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/{code}/g, emailOptIn) expect(sendAccountActivationEmail).toBeCalledWith({ - link: activationLink, + link: activationLink + '/a0000b0000c0000', firstName: 'Peter', lastName: 'Lustig', email: 'peter@lustig.de', From 36b4c6cce7f599cad8d33e18fb2b1643f9cbf7b3 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 22 Mar 2022 09:01:09 +0100 Subject: [PATCH 14/32] update-balance if link succesfully generated --- frontend/src/pages/Send.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index 89eb1bbe2..bce9a6069 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -143,6 +143,10 @@ export default { .then((result) => { this.code = result.data.createTransactionLink.code this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink + this.$emit( + 'update-balance', + this.transactionData.amount + this.transactionData.amount * 0.028, + ) }) .catch((error) => { this.toastError(error) From fe869e12c4ff64755ed318b52b313c4b238a14d6 Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Tue, 22 Mar 2022 12:31:44 +0100 Subject: [PATCH 15/32] Update backend/src/graphql/resolver/UserResolver.test.ts Co-authored-by: Moriz Wahl --- backend/src/graphql/resolver/UserResolver.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index a982f3768..ea78c56bd 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -54,7 +54,6 @@ describe('UserResolver', () => { lastName: 'Lustig', language: 'de', publisherId: 1234, - redeemCode: 'a0000b0000c0000', } let result: any From 7929b93964c254889379f7ded46aa658a172fcf4 Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Tue, 22 Mar 2022 12:33:10 +0100 Subject: [PATCH 16/32] Update backend/src/graphql/resolver/UserResolver.ts Co-authored-by: Ulf Gebhardt --- backend/src/graphql/resolver/UserResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 3b3ef394c..6d9e42405 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -306,7 +306,7 @@ export class UserResolver { @Authorized([RIGHTS.CREATE_USER]) @Mutation(() => User) async createUser( - @Args() { email, firstName, lastName, language, publisherId, redeemCode }: CreateUserArgs, + @Args() { email, firstName, lastName, language, publisherId, redeemCode = null}: CreateUserArgs, ): Promise { // TODO: wrong default value (should be null), how does graphql work here? Is it an required field? // default int publisher_id = 0; From eda69bfc47edecf508c7734ba508ec42d41d9e8d Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Tue, 22 Mar 2022 12:34:17 +0100 Subject: [PATCH 17/32] Update backend/src/graphql/resolver/UserResolver.ts Co-authored-by: Ulf Gebhardt --- backend/src/graphql/resolver/UserResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 6d9e42405..0e9e7c867 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -371,7 +371,7 @@ export class UserResolver { emailOptIn.verificationCode.toString(), ) - if (redeemCode !== '') { + if (redeemCode) { activationLink += '/' + redeemCode } From 0a3f80ddc9ee883edf24557030f8cfb2ba1e5b4b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 22 Mar 2022 17:53:51 +0100 Subject: [PATCH 18/32] add default properties to restore data when transaction is canceled in confirmation step --- frontend/src/components/GddSend/TransactionForm.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/GddSend/TransactionForm.vue b/frontend/src/components/GddSend/TransactionForm.vue index ec4aff4d3..c1acf9925 100644 --- a/frontend/src/components/GddSend/TransactionForm.vue +++ b/frontend/src/components/GddSend/TransactionForm.vue @@ -160,15 +160,18 @@ export default { }, props: { balance: { type: Number, default: 0 }, + email: { type: String, default: '' }, + amount: { type: Number, default: 0 }, + memo: { type: String, default: '' }, }, data() { return { amountFocused: false, emailFocused: false, form: { - email: '', - amount: '', - memo: '', + email: this.email, + amount: this.amount ? String(this.amount) : '', + memo: this.memo, amountValue: 0.0, }, selected: SEND_TYPES.send, From e08e1b7ea8618d675aea2ae23b5ff31616cdecf8 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 22 Mar 2022 17:54:55 +0100 Subject: [PATCH 19/32] remove update balance method and event. We want to have the data always from the backend and do no calculation in the frontend --- frontend/src/layouts/DashboardLayout_gdd.spec.js | 8 -------- frontend/src/layouts/DashboardLayout_gdd.vue | 4 ---- 2 files changed, 12 deletions(-) diff --git a/frontend/src/layouts/DashboardLayout_gdd.spec.js b/frontend/src/layouts/DashboardLayout_gdd.spec.js index 2a8b7bf42..fd45b9f05 100644 --- a/frontend/src/layouts/DashboardLayout_gdd.spec.js +++ b/frontend/src/layouts/DashboardLayout_gdd.spec.js @@ -140,14 +140,6 @@ describe('DashboardLayoutGdd', () => { }) }) - describe('update balance', () => { - it('updates the amount correctelly', async () => { - await wrapper.findComponent({ ref: 'router-view' }).vm.$emit('update-balance', 5) - await flushPromises() - expect(wrapper.vm.balance).toBe(-5) - }) - }) - describe('update transactions', () => { beforeEach(async () => { apolloMock.mockResolvedValue({ diff --git a/frontend/src/layouts/DashboardLayout_gdd.vue b/frontend/src/layouts/DashboardLayout_gdd.vue index 9c7cf9c0c..a2a76d88c 100755 --- a/frontend/src/layouts/DashboardLayout_gdd.vue +++ b/frontend/src/layouts/DashboardLayout_gdd.vue @@ -27,7 +27,6 @@ :transactionLinkCount="transactionLinkCount" :pending="pending" :decayStartBlock="decayStartBlock" - @update-balance="updateBalance" @update-transactions="updateTransactions" > @@ -112,9 +111,6 @@ export default { // what to do when loading balance fails? }) }, - updateBalance(ammount) { - this.balance -= ammount - }, admin() { window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('{token}', this.$store.state.token)) this.$store.dispatch('logout') // logout without redirect From 8c8d06d87c5c89f571ef65450ac54c6545b6fb9a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 22 Mar 2022 17:56:34 +0100 Subject: [PATCH 20/32] bind the transaction data to the transaction form to allow data restoration after canceling transaction confirmation, use always update transaction to update balance --- frontend/src/pages/Send.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index bce9a6069..38f232fda 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -3,7 +3,11 @@