From 52f9da5c0dfec289fe51ad26e3c0a5e391078854 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 18 Jan 2023 15:06:18 +0100 Subject: [PATCH 1/4] fix(backend): admin cannot delete confirmed contribution --- .../resolver/ContributionResolver.test.ts | 52 ++++++++++++++++++- .../graphql/resolver/ContributionResolver.ts | 4 ++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 9a7fb76f2..abae8e446 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -3,6 +3,7 @@ import Decimal from 'decimal.js-light' import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' +import { bobBaumeister } from '@/seeds/users/bob-baumeister' import { stephenHawking } from '@/seeds/users/stephen-hawking' import { garrickOllivander } from '@/seeds/users/garrick-ollivander' import { @@ -26,7 +27,13 @@ import { sendContributionConfirmedEmail, // sendContributionRejectedEmail, } from '@/emails/sendEmailVariants' -import { cleanDB, resetToken, testEnvironment, contributionDateFormatter } from '@test/helpers' +import { + cleanDB, + resetToken, + testEnvironment, + contributionDateFormatter, + resetEntity, +} from '@test/helpers' import { GraphQLError } from 'graphql' import { userFactory } from '@/seeds/factory/user' import { creationFactory } from '@/seeds/factory/creation' @@ -1818,6 +1825,49 @@ describe('ContributionResolver', () => { ) }) }) + + describe('creation already confirmed', () => { + it('throws an error', async () => { + await userFactory(testEnv, bobBaumeister) + await query({ + query: login, + variables: { email: 'bob@baumeister.de', password: 'Aa12345_' }, + }) + const { + data: { createContribution: confirmedContribution }, + } = await mutate({ + mutation: createContribution, + variables: { + amount: 100.0, + memo: 'Confirmed Contribution', + creationDate: contributionDateFormatter(new Date()), + }, + }) + await query({ + query: login, + variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, + }) + await mutate({ + mutation: confirmContribution, + variables: { + id: confirmedContribution.id ? confirmedContribution.id : -1, + }, + }) + await expect( + mutate({ + mutation: adminDeleteContribution, + variables: { + id: confirmedContribution.id ? confirmedContribution.id : -1, + }, + }), + ).resolves.toEqual( + expect.objectContaining({ + errors: [new GraphQLError('A confirmed contribution can not be deleted')], + }), + ) + await resetEntity(DbTransaction) + }) + }) }) describe('confirmContribution', () => { diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index afa786f38..a71e4767e 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -512,6 +512,10 @@ export class ContributionResolver { logger.error(`Contribution not found for given id: ${id}`) throw new Error('Contribution not found for given id.') } + if (contribution.confirmedAt) { + logger.error('A confirmed contribution can not be deleted') + throw new Error('A confirmed contribution can not be deleted') + } const moderator = getUser(context) if ( contribution.contributionType === ContributionType.USER && From 6d3cb57caf4f9cfc71856e0b1b2f7cea9f88fc3c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 18 Jan 2023 15:01:30 +0100 Subject: [PATCH 2/4] fix horas --- frontend/src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 7a210f6a0..b52edde1d 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -126,7 +126,7 @@ "firstname": "Firstname", "from": "from", "generate_now": "Generate now", - "hours": "Horas", + "hours": "Hours", "lastname": "Lastname", "memo": "Message", "message": "Message", From 443da2b863ed9277996e40d7bf58fc1a0b6e7b5e Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 18 Jan 2023 15:24:26 +0100 Subject: [PATCH 3/4] fix(frontend): submit contribution text --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 5c0ee9f96..ce9f8b41d 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -30,7 +30,7 @@ "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.", - "submitContribution": "schreiben" + "submitContribution": "Schreiben" }, "communityInfo": "Gemeinschaft Information", "contact": "Kontakt", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 7a210f6a0..fceb34fca 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -30,7 +30,7 @@ "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.", - "submitContribution": "writing" + "submitContribution": "Contribute" }, "communityInfo": "Community Information", "contact": "Contact", From a3dc4c168b101b00f7ec3bd456deb7e413194acb Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 18 Jan 2023 15:54:57 +0100 Subject: [PATCH 4/4] v1.17.0 --- CHANGELOG.md | 52 +++++++++++++++++++++++++++++++++++++++++++ admin/package.json | 2 +- backend/package.json | 2 +- database/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19957a309..165ed53e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,60 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.17.0](https://github.com/gradido/gradido/compare/1.16.0...1.17.0) + +- fix(frontend): submit contribution text [`#2573`](https://github.com/gradido/gradido/pull/2573) +- fix(backend): admin cannot delete confirmed contribution [`#2571`](https://github.com/gradido/gradido/pull/2571) +- fix(frontend): english locales - horas -> hours [`#2572`](https://github.com/gradido/gradido/pull/2572) +- fix(frontend): mobil divices datepicker add props dropleft [`#2570`](https://github.com/gradido/gradido/pull/2570) +- fix(frontend): pagination [`#2569`](https://github.com/gradido/gradido/pull/2569) +- fix(frontend): add a watch on gdt prop to assure propper loading when mounted [`#2568`](https://github.com/gradido/gradido/pull/2568) +- refactor(frontend): creation step in quarter hour set [`#2566`](https://github.com/gradido/gradido/pull/2566) +- fix(frontend): tunneled email on right side last transactions [`#2561`](https://github.com/gradido/gradido/pull/2561) +- feat(frontend): test transaction page [`#2555`](https://github.com/gradido/gradido/pull/2555) +- refactor(backend): statistics with field resolvers [`#2553`](https://github.com/gradido/gradido/pull/2553) +- fix(frontend): normalized amount transaction if processed again [`#2550`](https://github.com/gradido/gradido/pull/2550) +- fix(backend): semaphore deadlock [`#2551`](https://github.com/gradido/gradido/pull/2551) +- fix(frontend): mobile design [`#2552`](https://github.com/gradido/gradido/pull/2552) +- refactor(frontend): slots for right sidebar and header [`#2548`](https://github.com/gradido/gradido/pull/2548) +- fix(frontend): creation menu highlighted on all submenus [`#2527`](https://github.com/gradido/gradido/pull/2527) +- refactor(frontend): computed hours for open creations [`#2545`](https://github.com/gradido/gradido/pull/2545) +- feat(other): add description for daily backup cronjob [`#2532`](https://github.com/gradido/gradido/pull/2532) +- fix(frontend): editing transaction does not work [`#2543`](https://github.com/gradido/gradido/pull/2543) +- refactor(frontend): remove open creations from store [`#2541`](https://github.com/gradido/gradido/pull/2541) +- feat(other): vscode extensions [`#2524`](https://github.com/gradido/gradido/pull/2524) +- fix(backend): remove jest from dependecies [`#2533`](https://github.com/gradido/gradido/pull/2533) +- fix(frontend): initials without space [`#2546`](https://github.com/gradido/gradido/pull/2546) +- fix(backend): fix backend not confirmable [`#2539`](https://github.com/gradido/gradido/pull/2539) +- fix(frontend): send gdd and send link gdd is running [`#2534`](https://github.com/gradido/gradido/pull/2534) +- fix(other): update browser list [`#2540`](https://github.com/gradido/gradido/pull/2540) +- test(backend): increase backend coverage to 78% [`#2542`](https://github.com/gradido/gradido/pull/2542) +- fix(frontend): pagination gdt [`#2525`](https://github.com/gradido/gradido/pull/2525) +- fix(frontend): leaves are over the user symbol [`#2526`](https://github.com/gradido/gradido/pull/2526) +- fix(frontend): input-email label and placeholder are displayed correctly per language [`#2528`](https://github.com/gradido/gradido/pull/2528) +- feat(backend): add hideAmountGDD & hideAmountGDT to users table. [`#2506`](https://github.com/gradido/gradido/pull/2506) +- fix(frontend): avatar initials always has 2 letters [`#2530`](https://github.com/gradido/gradido/pull/2530) +- refactor(backend): seed contributions as user [`#2460`](https://github.com/gradido/gradido/pull/2460) +- fix(backend): fix logger middleware [`#2503`](https://github.com/gradido/gradido/pull/2503) +- fix(backend): fix email text [`#2523`](https://github.com/gradido/gradido/pull/2523) +- feat(other): new scopes for lint pr [`#2489`](https://github.com/gradido/gradido/pull/2489) +- fix(backend): fix config - some typos [`#2477`](https://github.com/gradido/gradido/pull/2477) +- style(frontend): new Design [`#2297`](https://github.com/gradido/gradido/pull/2297) +- refactor(other): adjust some texts and translations [`#2504`](https://github.com/gradido/gradido/pull/2504) +- test(other): fix tests breaking with the new year [`#2505`](https://github.com/gradido/gradido/pull/2505) +- feat(backend): federation implement exchange of api versions persist in table [`#2427`](https://github.com/gradido/gradido/pull/2427) +- feat(backend): semaphore to lock transaction table [`#2458`](https://github.com/gradido/gradido/pull/2458) +- feat(backend): design html emails and adjust texts [`#2472`](https://github.com/gradido/gradido/pull/2472) +- feat(backend): test semaphore [`#2468`](https://github.com/gradido/gradido/pull/2468) +- fix(admin): reduce triggers of success toast on deleted user form to exactly one [`#2471`](https://github.com/gradido/gradido/pull/2471) +- refactor(other): build nginx docker image in workflow independent of other builds [`#2470`](https://github.com/gradido/gradido/pull/2470) +- feat(backend): setup unit tests for federation [`#2465`](https://github.com/gradido/gradido/pull/2465) + #### [1.16.0](https://github.com/gradido/gradido/compare/1.15.0...1.16.0) +> 15 December 2022 + +- feat(release): version 1.16.0 [`#2467`](https://github.com/gradido/gradido/pull/2467) - refactor(backend): cleaning user related old password junk [`#2426`](https://github.com/gradido/gradido/pull/2426) - fix(database): consistent transaction table [`#2453`](https://github.com/gradido/gradido/pull/2453) - refactor(backend): dissolve admin resolver [`#2416`](https://github.com/gradido/gradido/pull/2416) diff --git a/admin/package.json b/admin/package.json index 58eb48d09..aabe002b4 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.16.0", + "version": "1.17.0", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index 1fb27f05f..cd0a8f6bc 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.16.0", + "version": "1.17.0", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", diff --git a/database/package.json b/database/package.json index 0c69941b4..6fc745500 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.16.0", + "version": "1.17.0", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", diff --git a/frontend/package.json b/frontend/package.json index 9c9f47e53..55e28b45c 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.16.0", + "version": "1.17.0", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index a4bedfdf2..539a13b66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.16.0", + "version": "1.17.0", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",