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>>) {
await queryFn('ALTER TABLE `transactions` DROP COLUMN `user_gradido_id`;')
await queryFn('ALTER TABLE `transactions` DROP COLUMN `user_name`;')

View File

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

View File

@ -1,11 +1,12 @@
<template>
<div class="redeem-information">
<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 }}
{{ $t('contribution-link.thanksYouWith') }} {{ amount | GDD }}
</h1>
<h1 v-else>
<h1 v-if="!isContributionLink && amount !== ''">
{{ user.firstName }}
{{ $t('transaction-link.send_you') }} {{ amount | GDD }}
</h1>

View File

@ -3,7 +3,12 @@
<redeem-information v-bind="linkData" :isContributionLink="isContributionLink" />
<b-jumbotron>
<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') }}
</b-button>
</div>
@ -21,6 +26,7 @@ export default {
props: {
linkData: { type: Object, required: true },
isContributionLink: { type: Boolean, default: false },
validLink: { type: Boolean, default: false },
},
}
</script>

View File

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

View File

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

View File

@ -374,12 +374,12 @@ describe('TransactionLink', () => {
describe('error on transaction link query', () => {
beforeEach(() => {
apolloQueryMock.mockRejectedValue({ message: 'Ouchh!' })
apolloQueryMock.mockRejectedValue({ message: 'gdd_per_link.redeemlink-error' })
wrapper = Wrapper()
})
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
:linkData="linkData"
:isContributionLink="isContributionLink"
:validLink="validLink"
@mutation-link="mutationLink"
/>
</template>
@ -47,12 +48,13 @@ export default {
return {
linkData: {
__typename: 'TransactionLink',
amount: '123.45',
memo: 'memo',
amount: '',
memo: '',
user: {
firstName: 'Bibi',
firstName: '',
},
deletedAt: null,
validLink: false,
},
}
},
@ -67,13 +69,14 @@ export default {
},
})
.then((result) => {
this.validLink = true
this.linkData = result.data.queryTransactionLink
if (this.linkData.__typename === 'ContributionLink' && this.$store.state.token) {
this.mutationLink(this.linkData.amount)
}
})
.catch((err) => {
this.toastError(err.message)
.catch(() => {
this.toastError(this.$t('gdd_per_link.redeemlink-error'))
})
},
mutationLink(amount) {