Merge branch 'master' into federation-remove-getSeed

This commit is contained in:
Ulf Gebhardt 2023-06-06 11:09:15 +02:00 committed by GitHub
commit e2b459cdd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 22 deletions

View File

@ -66,8 +66,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
) )
} }
/* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) { export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
await queryFn('ALTER TABLE `transactions` DROP COLUMN `user_gradido_id`;') await queryFn('ALTER TABLE `transactions` DROP COLUMN `user_gradido_id`;')
await queryFn('ALTER TABLE `transactions` DROP COLUMN `user_name`;') await queryFn('ALTER TABLE `transactions` DROP COLUMN `user_name`;')

View File

@ -19,7 +19,7 @@ enum ApiVersionType {
V1_1 = '1_1', V1_1 = '1_1',
V2_0 = '2_0', V2_0 = '2_0',
} }
export type CommunityApi = { type CommunityApi = {
api: string api: string
url: string url: string
} }
@ -250,14 +250,11 @@ async function writeHomeCommunityEntry(pubKey: string): Promise<void> {
} }
const newCommunityUuid = async (): Promise<string> => { const newCommunityUuid = async (): Promise<string> => {
let uuid: string while (true) {
let countIds: number const communityUuid = uuidv4()
do { if ((await DbCommunity.count({ where: { communityUuid } })) === 0) {
uuid = uuidv4() return communityUuid
countIds = await DbCommunity.count({ where: { communityUuid: uuid } })
if (countIds > 0) {
logger.info('CommunityUuid creation conflict...')
} }
} while (countIds > 0) logger.info('CommunityUuid creation conflict...', communityUuid)
return uuid }
} }

View File

@ -1,11 +1,12 @@
<template> <template>
<div class="redeem-information"> <div class="redeem-information">
<b-jumbotron bg-variant="muted" text-variant="dark" border-variant="info"> <b-jumbotron bg-variant="muted" text-variant="dark" border-variant="info">
<h1 v-if="isContributionLink"> <h1 v-if="amount === ''">{{ $t('gdd_per_link.redeemlink-error') }}</h1>
<h1 v-if="isContributionLink && amount !== ''">
{{ CONFIG.COMMUNITY_NAME }} {{ CONFIG.COMMUNITY_NAME }}
{{ $t('contribution-link.thanksYouWith') }} {{ amount | GDD }} {{ $t('contribution-link.thanksYouWith') }} {{ amount | GDD }}
</h1> </h1>
<h1 v-else> <h1 v-if="!isContributionLink && amount !== ''">
{{ user.firstName }} {{ user.firstName }}
{{ $t('transaction-link.send_you') }} {{ amount | GDD }} {{ $t('transaction-link.send_you') }} {{ amount | GDD }}
</h1> </h1>

View File

@ -3,7 +3,12 @@
<redeem-information v-bind="linkData" :isContributionLink="isContributionLink" /> <redeem-information v-bind="linkData" :isContributionLink="isContributionLink" />
<b-jumbotron> <b-jumbotron>
<div class="mb-3 text-center"> <div class="mb-3 text-center">
<b-button variant="gradido" @click="$emit('mutation-link', linkData.amount)" size="lg"> <b-button
variant="gradido"
@click="$emit('mutation-link', linkData.amount)"
size="lg"
:disabled="!validLink"
>
{{ $t('gdd_per_link.redeem') }} {{ $t('gdd_per_link.redeem') }}
</b-button> </b-button>
</div> </div>
@ -21,6 +26,7 @@ export default {
props: { props: {
linkData: { type: Object, required: true }, linkData: { type: Object, required: true },
isContributionLink: { type: Boolean, default: false }, isContributionLink: { type: Boolean, default: false },
validLink: { type: Boolean, default: false },
}, },
} }
</script> </script>

View File

@ -210,6 +210,7 @@
"redeemed": "Erfolgreich eingelöst! Deinem Konto wurden {n} GDD gutgeschrieben.", "redeemed": "Erfolgreich eingelöst! Deinem Konto wurden {n} GDD gutgeschrieben.",
"redeemed-at": "Der Link wurde bereits am {date} eingelöst.", "redeemed-at": "Der Link wurde bereits am {date} eingelöst.",
"redeemed-title": "eingelöst", "redeemed-title": "eingelöst",
"redeemlink-error": "Dieser Einlöse-Link ist nicht vollständig.",
"to-login": "Log dich ein", "to-login": "Log dich ein",
"to-register": "Registriere ein neues Konto.", "to-register": "Registriere ein neues Konto.",
"validUntil": "Gültig bis", "validUntil": "Gültig bis",

View File

@ -210,6 +210,7 @@
"redeemed": "Successfully redeemed! Your account has been credited with {n} GDD.", "redeemed": "Successfully redeemed! Your account has been credited with {n} GDD.",
"redeemed-at": "The link was already redeemed on {date}.", "redeemed-at": "The link was already redeemed on {date}.",
"redeemed-title": "redeemed", "redeemed-title": "redeemed",
"redeemlink-error": "This redemption link is not complete.",
"to-login": "Log in", "to-login": "Log in",
"to-register": "Register a new account.", "to-register": "Register a new account.",
"validUntil": "Valid until", "validUntil": "Valid until",

View File

@ -374,12 +374,12 @@ describe('TransactionLink', () => {
describe('error on transaction link query', () => { describe('error on transaction link query', () => {
beforeEach(() => { beforeEach(() => {
apolloQueryMock.mockRejectedValue({ message: 'Ouchh!' }) apolloQueryMock.mockRejectedValue({ message: 'gdd_per_link.redeemlink-error' })
wrapper = Wrapper() wrapper = Wrapper()
}) })
it('toasts an error message', () => { it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('Ouchh!') expect(toastErrorSpy).toBeCalledWith('gdd_per_link.redeemlink-error')
}) })
}) })
}) })

View File

@ -14,6 +14,7 @@
<redeem-valid <redeem-valid
:linkData="linkData" :linkData="linkData"
:isContributionLink="isContributionLink" :isContributionLink="isContributionLink"
:validLink="validLink"
@mutation-link="mutationLink" @mutation-link="mutationLink"
/> />
</template> </template>
@ -47,12 +48,13 @@ export default {
return { return {
linkData: { linkData: {
__typename: 'TransactionLink', __typename: 'TransactionLink',
amount: '123.45', amount: '',
memo: 'memo', memo: '',
user: { user: {
firstName: 'Bibi', firstName: '',
}, },
deletedAt: null, deletedAt: null,
validLink: false,
}, },
} }
}, },
@ -67,13 +69,14 @@ export default {
}, },
}) })
.then((result) => { .then((result) => {
this.validLink = true
this.linkData = result.data.queryTransactionLink this.linkData = result.data.queryTransactionLink
if (this.linkData.__typename === 'ContributionLink' && this.$store.state.token) { if (this.linkData.__typename === 'ContributionLink' && this.$store.state.token) {
this.mutationLink(this.linkData.amount) this.mutationLink(this.linkData.amount)
} }
}) })
.catch((err) => { .catch(() => {
this.toastError(err.message) this.toastError(this.$t('gdd_per_link.redeemlink-error'))
}) })
}, },
mutationLink(amount) { mutationLink(amount) {