Merge branch 'master' into daily-rule-for-contribution-links-frontend

This commit is contained in:
Moriz Wahl 2022-10-13 16:51:11 +02:00 committed by GitHub
commit 5d37bd6df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 8 deletions

View File

@ -1795,13 +1795,14 @@ describe('AdminResolver', () => {
}) })
describe('Contribution Links', () => { describe('Contribution Links', () => {
const now = new Date()
const variables = { const variables = {
amount: new Decimal(200), amount: new Decimal(200),
name: 'Dokumenta 2022', name: 'Dokumenta 2022',
memo: 'Danke für deine Teilnahme an der Dokumenta 2022', memo: 'Danke für deine Teilnahme an der Dokumenta 2022',
cycle: 'once', cycle: 'once',
validFrom: new Date(2022, 5, 18).toISOString(), validFrom: new Date(2022, 5, 18).toISOString(),
validTo: new Date(2022, 7, 14).toISOString(), validTo: new Date(now.getFullYear() + 1, 7, 14).toISOString(),
maxAmountPerMonth: new Decimal(200), maxAmountPerMonth: new Decimal(200),
maxPerCycle: 1, maxPerCycle: 1,
} }
@ -1983,7 +1984,7 @@ describe('AdminResolver', () => {
name: 'Dokumenta 2022', name: 'Dokumenta 2022',
memo: 'Danke für deine Teilnahme an der Dokumenta 2022', memo: 'Danke für deine Teilnahme an der Dokumenta 2022',
validFrom: new Date('2022-06-18T00:00:00.000Z'), validFrom: new Date('2022-06-18T00:00:00.000Z'),
validTo: new Date('2022-08-14T00:00:00.000Z'), validTo: expect.any(Date),
cycle: 'once', cycle: 'once',
maxPerCycle: 1, maxPerCycle: 1,
totalMaxCountOfContribution: null, totalMaxCountOfContribution: null,

View File

@ -678,6 +678,7 @@ export class AdminResolver {
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
): Promise<ContributionLinkList> { ): Promise<ContributionLinkList> {
const [links, count] = await DbContributionLink.findAndCount({ const [links, count] = await DbContributionLink.findAndCount({
where: [{ validTo: MoreThan(new Date()) }, { validTo: IsNull() }],
order: { createdAt: order }, order: { createdAt: order },
skip: (currentPage - 1) * pageSize, skip: (currentPage - 1) * pageSize,
take: pageSize, take: pageSize,

View File

@ -360,7 +360,7 @@ describe('UserResolver', () => {
beforeAll(async () => { beforeAll(async () => {
await userFactory(testEnv, peterLustig) await userFactory(testEnv, peterLustig)
await userFactory(testEnv, bobBaumeister) await userFactory(testEnv, bobBaumeister)
await query({ query: login, variables: bobData }) await mutate({ mutation: login, variables: bobData })
// create contribution as user bob // create contribution as user bob
contribution = await mutate({ contribution = await mutate({
@ -369,7 +369,7 @@ describe('UserResolver', () => {
}) })
// login as admin // login as admin
await query({ query: login, variables: peterData }) await mutate({ mutation: login, variables: peterData })
// confirm the contribution // confirm the contribution
contribution = await mutate({ contribution = await mutate({
@ -378,7 +378,7 @@ describe('UserResolver', () => {
}) })
// login as user bob // login as user bob
bob = await query({ query: login, variables: bobData }) bob = await mutate({ mutation: login, variables: bobData })
// create transaction link // create transaction link
await transactionLinkFactory(testEnv, { await transactionLinkFactory(testEnv, {

View File

@ -24,7 +24,8 @@
"moderator": "Moderator", "moderator": "Moderator",
"moderators": "Moderatoren", "moderators": "Moderatoren",
"myContributions": "Meine Beiträge zum Gemeinwohl", "myContributions": "Meine Beiträge zum Gemeinwohl",
"openContributionLinks": "öffentliche Beitrags-Linkliste", "noOpenContributionLinkText": "Zur Zeit gibt es keine automatischen Schöpfungen.",
"openContributionLinks": "Öffentliche Beitrags-Linkliste",
"openContributionLinkText": "Folgende {count} automatische Schöpfungen werden zur Zeit durch die Gemeinschaft „{name}“ bereitgestellt.", "openContributionLinkText": "Folgende {count} automatische Schöpfungen werden zur Zeit durch die Gemeinschaft „{name}“ bereitgestellt.",
"other-communities": "Weitere Gemeinschaften", "other-communities": "Weitere Gemeinschaften",
"submitContribution": "Beitrag einreichen", "submitContribution": "Beitrag einreichen",

View File

@ -24,7 +24,8 @@
"moderator": "Moderator", "moderator": "Moderator",
"moderators": "Moderators", "moderators": "Moderators",
"myContributions": "My contributions to the common good", "myContributions": "My contributions to the common good",
"openContributionLinks": "open Contribution links list", "noOpenContributionLinkText": "Currently there are no automatic creations.",
"openContributionLinks": "Open contribution-link list",
"openContributionLinkText": "The following {count} automatic creations are currently provided by the \"{name}\" community.", "openContributionLinkText": "The following {count} automatic creations are currently provided by the \"{name}\" community.",
"other-communities": "Other communities", "other-communities": "Other communities",
"submitContribution": "Submit contribution", "submitContribution": "Submit contribution",

View File

@ -14,7 +14,7 @@
<hr /> <hr />
<b-container> <b-container>
<div class="h3">{{ $t('community.openContributionLinks') }}</div> <div class="h3">{{ $t('community.openContributionLinks') }}</div>
<small> <small v-if="count > 0">
{{ {{
$t('community.openContributionLinkText', { $t('community.openContributionLinkText', {
name: CONFIG.COMMUNITY_NAME, name: CONFIG.COMMUNITY_NAME,
@ -22,6 +22,9 @@
}) })
}} }}
</small> </small>
<small v-else>
{{ $t('community.noOpenContributionLinkText') }}
</small>
<ul> <ul>
<li v-for="item in itemsContributionLinks" v-bind:key="item.id"> <li v-for="item in itemsContributionLinks" v-bind:key="item.id">
<div>{{ item.name }}</div> <div>{{ item.name }}</div>