Merge branch 'master' into 1813-QR-Code-Popup

This commit is contained in:
Alexander Friedland 2022-04-22 11:34:04 +02:00 committed by GitHub
commit 17a96a5c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 60 additions and 32 deletions

View File

@ -1,4 +1,4 @@
CONFIG_VERSION=v5.2022-04-12 CONFIG_VERSION=v6.2022-04-21
# Server # Server
PORT=4000 PORT=4000
@ -27,6 +27,7 @@ KLICKTIPP_APIKEY_EN=SomeFakeKeyEN
COMMUNITY_NAME=Gradido Entwicklung COMMUNITY_NAME=Gradido Entwicklung
COMMUNITY_URL=http://localhost/ COMMUNITY_URL=http://localhost/
COMMUNITY_REGISTER_URL=http://localhost/register COMMUNITY_REGISTER_URL=http://localhost/register
COMMUNITY_REDEEM_URL=http://localhost/redeem/{code}
COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido. COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido.
# Login Server # Login Server

View File

@ -26,6 +26,7 @@ KLICKTIPP_APIKEY_EN=$KLICKTIPP_APIKEY_EN
COMMUNITY_NAME=$COMMUNITY_NAME COMMUNITY_NAME=$COMMUNITY_NAME
COMMUNITY_URL=$COMMUNITY_URL COMMUNITY_URL=$COMMUNITY_URL
COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL
COMMUNITY_REDEEM_URL=$COMMUNITY_REDEEM_URL
COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION
# Login Server # Login Server

View File

@ -14,7 +14,7 @@ const constants = {
DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0
CONFIG_VERSION: { CONFIG_VERSION: {
DEFAULT: 'DEFAULT', DEFAULT: 'DEFAULT',
EXPECTED: 'v5.2022-04-12', EXPECTED: 'v6.2022-04-21',
CURRENT: '', CURRENT: '',
}, },
} }
@ -50,6 +50,7 @@ const community = {
COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung', COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung',
COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/', COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/',
COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register', COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register',
COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/{code}',
COMMUNITY_DESCRIPTION: COMMUNITY_DESCRIPTION:
process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.', process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.',
} }

View File

@ -2,6 +2,7 @@ import { ObjectType, Field, Int } from 'type-graphql'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
import { User } from './User' import { User } from './User'
import CONFIG from '@/config'
@ObjectType() @ObjectType()
export class TransactionLink { export class TransactionLink {
@ -17,6 +18,7 @@ export class TransactionLink {
this.deletedAt = transactionLink.deletedAt this.deletedAt = transactionLink.deletedAt
this.redeemedAt = transactionLink.redeemedAt this.redeemedAt = transactionLink.redeemedAt
this.redeemedBy = redeemedBy this.redeemedBy = redeemedBy
this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code)
} }
@Field(() => Number) @Field(() => Number)
@ -51,6 +53,9 @@ export class TransactionLink {
@Field(() => User, { nullable: true }) @Field(() => User, { nullable: true })
redeemedBy: User | null redeemedBy: User | null
@Field(() => String)
link: string
} }
@ObjectType() @ObjectType()

View File

@ -24,7 +24,7 @@ COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register
COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community"
# backend # backend
BACKEND_CONFIG_VERSION=v5.2022-04-12 BACKEND_CONFIG_VERSION=v6.2022-04-21
JWT_EXPIRES_IN=30m JWT_EXPIRES_IN=30m
GDT_API_URL=https://gdt.gradido.net GDT_API_URL=https://gdt.gradido.net

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="clipboard-copy"> <div class="clipboard-copy">
<b-input-group size="lg" class="mb-3" prepend="Link"> <b-input-group size="lg" class="mb-3" prepend="Link">
<b-form-input :value="text" type="text" readonly></b-form-input> <b-form-input :value="link" type="text" readonly></b-form-input>
<b-input-group-append> <b-input-group-append>
<b-button size="sm" text="Button" variant="success" @click="CopyLink"> <b-button size="sm" text="Button" variant="success" @click="CopyLink">
{{ $t('gdd_per_link.copy') }} {{ $t('gdd_per_link.copy') }}
@ -14,12 +14,12 @@
export default { export default {
name: 'ClipboardCopy', name: 'ClipboardCopy',
props: { props: {
text: { type: String, required: true }, link: { type: String, required: true },
}, },
methods: { methods: {
CopyLink() { CopyLink() {
navigator.clipboard navigator.clipboard
.writeText(this.url) .writeText(this.link)
.then(() => { .then(() => {
this.toastSuccess(this.$t('gdd_per_link.link-copied')) this.toastSuccess(this.$t('gdd_per_link.link-copied'))
}) })

View File

@ -17,6 +17,7 @@ const propsData = {
{ {
amount: '5', amount: '5',
code: 'ce28664b5308c17f931c0367', code: 'ce28664b5308c17f931c0367',
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 87, id: 87,
@ -27,6 +28,7 @@ const propsData = {
{ {
amount: '6', amount: '6',
code: 'ce28664b5308c17f931c0367', code: 'ce28664b5308c17f931c0367',
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 86, id: 86,

View File

@ -4,7 +4,7 @@
<b-card class="p-0 gradido-custom-background"> <b-card class="p-0 gradido-custom-background">
<div class="h3 mb-4">{{ $t('gdd_per_link.created') }}</div> <div class="h3 mb-4">{{ $t('gdd_per_link.created') }}</div>
<clipboard-copy :text="link" /> <clipboard-copy :link="link" />
<div class="text-center"> <div class="text-center">
<figure-qr-code :text="link" /> <figure-qr-code :text="link" />
@ -28,15 +28,10 @@ export default {
FigureQrCode, FigureQrCode,
}, },
props: { props: {
code: { link: {
type: String, type: String,
required: true, required: true,
}, },
}, },
computed: {
link() {
return `${window.location.origin}/redeem/${this.code}`
},
},
} }
</script> </script>

View File

@ -22,7 +22,7 @@ const mocks = {
const propsData = { const propsData = {
amount: '75', amount: '75',
code: 'c00000000c000000c0000', link: 'http://localhost/redeem/c00000000c000000c0000',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 12, id: 12,
memo: 'Katzenauge, Eulenschrei, was verschwunden komm herbei!', memo: 'Katzenauge, Eulenschrei, was verschwunden komm herbei!',

View File

@ -79,7 +79,7 @@ export default {
}, },
props: { props: {
amount: { type: String, required: true }, amount: { type: String, required: true },
code: { type: String, required: true }, link: { type: String, required: true },
holdAvailableAmount: { type: String, required: true }, holdAvailableAmount: { type: String, required: true },
id: { type: Number, required: true }, id: { type: Number, required: true },
memo: { type: String, required: true }, memo: { type: String, required: true },
@ -120,9 +120,6 @@ export default {
decay() { decay() {
return `${this.amount - this.holdAvailableAmount}` return `${this.amount - this.holdAvailableAmount}`
}, },
link() {
return `${window.location.origin}/redeem/${this.code}`
},
}, },
} }
</script> </script>

View File

@ -44,7 +44,7 @@ describe('TransactionLinkSummary', () => {
listTransactionLinks: [ listTransactionLinks: [
{ {
amount: '75', amount: '75',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 86, id: 86,
@ -55,7 +55,7 @@ describe('TransactionLinkSummary', () => {
}, },
{ {
amount: '85', amount: '85',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 107, id: 107,
@ -65,7 +65,7 @@ describe('TransactionLinkSummary', () => {
}, },
{ {
amount: '95', amount: '95',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 92, id: 92,
@ -76,7 +76,7 @@ describe('TransactionLinkSummary', () => {
}, },
{ {
amount: '150', amount: '150',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 16, id: 16,
@ -132,6 +132,27 @@ describe('TransactionLinkSummary', () => {
it('has no component CollapseLinksList', () => { it('has no component CollapseLinksList', () => {
expect(wrapper.findComponent({ name: 'CollapseLinksList' }).isVisible()).toBe(false) expect(wrapper.findComponent({ name: 'CollapseLinksList' }).isVisible()).toBe(false)
}) })
describe('reopen transaction link details', () => {
beforeEach(() => {
jest.clearAllMocks()
wrapper.find('div.transaction-link-details').trigger('click')
})
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('load more transaction links', () => { describe('load more transaction links', () => {
@ -142,7 +163,7 @@ describe('TransactionLinkSummary', () => {
listTransactionLinks: [ listTransactionLinks: [
{ {
amount: '76', amount: '76',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 87, id: 87,
@ -153,7 +174,7 @@ describe('TransactionLinkSummary', () => {
}, },
{ {
amount: '86', amount: '86',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 108, id: 108,
@ -164,7 +185,7 @@ describe('TransactionLinkSummary', () => {
}, },
{ {
amount: '96', amount: '96',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 93, id: 93,
@ -175,7 +196,7 @@ describe('TransactionLinkSummary', () => {
}, },
{ {
amount: '150', amount: '150',
code: 'ce28664b5308c17f931c0367', link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z', createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111', holdAvailableAmount: '5.13109484759482747111',
id: 17, id: 17,

View File

@ -83,6 +83,7 @@ export default {
if (this.visible) { if (this.visible) {
this.visible = false this.visible = false
} else { } else {
this.transactionLinks = []
this.updateListTransactionLinks() this.updateListTransactionLinks()
this.visible = true this.visible = true
} }

View File

@ -75,7 +75,7 @@ export const sendCoins = gql`
export const createTransactionLink = gql` export const createTransactionLink = gql`
mutation($amount: Decimal!, $memo: String!) { mutation($amount: Decimal!, $memo: String!) {
createTransactionLink(amount: $amount, memo: $memo) { createTransactionLink(amount: $amount, memo: $memo) {
code link
} }
} }
` `

View File

@ -139,7 +139,7 @@ export const listTransactionLinks = gql`
amount amount
holdAvailableAmount holdAvailableAmount
memo memo
code link
createdAt createdAt
validUntil validUntil
redeemedAt redeemedAt

View File

@ -162,7 +162,11 @@ describe('Send', () => {
describe('transaction form link', () => { describe('transaction form link', () => {
beforeEach(async () => { beforeEach(async () => {
apolloMutationMock.mockResolvedValue({ apolloMutationMock.mockResolvedValue({
data: { createTransactionLink: { code: '0123456789' } }, data: {
createTransactionLink: {
link: 'http://localhost/redeem/0123456789',
},
},
}) })
const transactionForm = wrapper.findComponent({ name: 'TransactionForm' }) const transactionForm = wrapper.findComponent({ name: 'TransactionForm' })
await transactionForm.findAll('input[type="radio"]').at(1).setChecked() await transactionForm.findAll('input[type="radio"]').at(1).setChecked()

View File

@ -41,7 +41,7 @@
></transaction-result-send-error> ></transaction-result-send-error>
</template> </template>
<template #transactionResultLink> <template #transactionResultLink>
<transaction-result-link :code="code" @on-reset="onReset"></transaction-result-link> <transaction-result-link :link="link" @on-reset="onReset"></transaction-result-link>
</template> </template>
</gdd-send> </gdd-send>
<hr /> <hr />
@ -87,7 +87,7 @@ export default {
errorResult: '', errorResult: '',
currentTransactionStep: TRANSACTION_STEPS.transactionForm, currentTransactionStep: TRANSACTION_STEPS.transactionForm,
loading: false, loading: false,
code: null, link: null,
} }
}, },
props: { props: {
@ -144,7 +144,7 @@ export default {
}) })
.then((result) => { .then((result) => {
this.$emit('set-tunneled-email', null) this.$emit('set-tunneled-email', null)
this.code = result.data.createTransactionLink.code this.link = result.data.createTransactionLink.link
this.transactionData = { ...EMPTY_TRANSACTION_DATA } this.transactionData = { ...EMPTY_TRANSACTION_DATA }
this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink
this.updateTransactions({}) this.updateTransactions({})