From 173d8e86902639c0d2b2e9d73fc76acc34774ce1 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 31 Jan 2023 11:29:39 +0100 Subject: [PATCH 01/36] change text for gdd_per_link.choose-amount --- 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 a51b48e37..b4623dec5 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -164,7 +164,7 @@ "GDD": "GDD", "gddKonto": "GDD Konto", "gdd_per_link": { - "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest. Du kannst auch noch eine Nachricht eintragen. Beim Klick „Jetzt generieren“ wird ein Link erstellt, den du versenden kannst.", + "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest, und trage eine Nachricht ein. Die Nachricht ist Pflichtfeld.", "copy-link": "Link kopieren", "copy-link-with-text": "Link und Text kopieren", "created": "Der Link wurde erstellt!", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index ce65ac9af..011a96de0 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -164,7 +164,7 @@ "GDD": "GDD", "gddKonto": "GDD Konto", "gdd_per_link": { - "choose-amount": "Select an amount that you would like to send via link. You can also enter a message. Click 'Generate now' to create a link that you can share.", + "choose-amount": "Select an amount you want to send via link and enter a message. The message is mandatory.", "copy-link": "Copy link", "copy-link-with-text": "Copy link and text", "created": "Link was created!", From 63b6e9491ace432adb9cfc9b4bb3d7f0d7a0af0b Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Thu, 2 Feb 2023 10:33:51 +0100 Subject: [PATCH 02/36] Update frontend/src/locales/de.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- frontend/src/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index b4623dec5..c00646e50 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -164,7 +164,7 @@ "GDD": "GDD", "gddKonto": "GDD Konto", "gdd_per_link": { - "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest, und trage eine Nachricht ein. Die Nachricht ist Pflichtfeld.", + "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest, und trage eine Nachricht ein. Die Nachricht ist ein Pflichtfeld.", "copy-link": "Link kopieren", "copy-link-with-text": "Link und Text kopieren", "created": "Der Link wurde erstellt!", From 33e87ddd92b6316ed3faefe4a9a00efb74ca0bc5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 3 Feb 2023 00:13:25 +0100 Subject: [PATCH 03/36] fix logger on contributionMessageResolver --- .../ContributionMessageResolver.test.ts | 56 ++++++++++++------- .../resolver/ContributionMessageResolver.ts | 17 ++---- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index 436830c2c..36d78c382 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -88,6 +88,7 @@ describe('ContributionMessageResolver', () => { describe('input not valid', () => { it('throws error when contribution does not exist', async () => { + jest.clearAllMocks() await expect( mutate({ mutation: adminCreateContributionMessage, @@ -98,16 +99,20 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [ - new GraphQLError( - 'ContributionMessage was not successful: Error: Contribution not found', - ), - ], + errors: [new GraphQLError('ContributionMessage was not sent successfully')], }), ) }) + it('logs the error thrown', () => { + expect(logger.error).toBeCalledWith( + 'ContributionMessage was not sent successfully', + new Error('Contribution not found'), + ) + }) + it('throws error when contribution.userId equals user.id', async () => { + jest.clearAllMocks() await mutate({ mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, @@ -130,14 +135,17 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [ - new GraphQLError( - 'ContributionMessage was not successful: Error: Admin can not answer on own contribution', - ), - ], + errors: [new GraphQLError('ContributionMessage was not sent successfully')], }), ) }) + + it('logs the error thrown', () => { + expect(logger.error).toBeCalledWith( + 'ContributionMessage was not sent successfully', + new Error('Admin can not answer on his own contribution'), + ) + }) }) describe('valid input', () => { @@ -210,6 +218,7 @@ describe('ContributionMessageResolver', () => { describe('input not valid', () => { it('throws error when contribution does not exist', async () => { + jest.clearAllMocks() await expect( mutate({ mutation: createContributionMessage, @@ -220,16 +229,20 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [ - new GraphQLError( - 'ContributionMessage was not successful: Error: Contribution not found', - ), - ], + errors: [new GraphQLError('ContributionMessage was not sent successfully')], }), ) }) + it('logs the error thrown', () => { + expect(logger.error).toBeCalledWith( + 'ContributionMessage was not sent successfully', + new Error('Contribution not found'), + ) + }) + it('throws error when other user tries to send createContributionMessage', async () => { + jest.clearAllMocks() await mutate({ mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, @@ -244,14 +257,17 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [ - new GraphQLError( - 'ContributionMessage was not successful: Error: Can not send message to contribution of another user', - ), - ], + errors: [new GraphQLError('ContributionMessage was not sent successfully')], }), ) }) + + it('logs the error thrown', () => { + expect(logger.error).toBeCalledWith( + 'ContributionMessage was not sent successfully', + new Error('Can not send message to contribution of another user'), + ) + }) }) describe('valid input', () => { diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.ts b/backend/src/graphql/resolver/ContributionMessageResolver.ts index 38bea804e..9544f81c4 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.ts @@ -16,6 +16,7 @@ import { backendLogger as logger } from '@/server/logger' import { RIGHTS } from '@/auth/RIGHTS' import { Context, getUser } from '@/server/context' import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants' +import LogError from '@/server/LogError' @Resolver() export class ContributionMessageResolver { @@ -54,8 +55,7 @@ export class ContributionMessageResolver { await queryRunner.commitTransaction() } catch (e) { await queryRunner.rollbackTransaction() - logger.error(`ContributionMessage was not successful: ${e}`) - throw new Error(`ContributionMessage was not successful: ${e}`) + throw new LogError('ContributionMessage was not sent successfully', e) } finally { await queryRunner.release() } @@ -95,9 +95,7 @@ export class ContributionMessageResolver { @Ctx() context: Context, ): Promise { const user = getUser(context) - if (!user.emailContact) { - user.emailContact = await UserContact.findOneOrFail({ where: { id: user.emailId } }) - } + const queryRunner = getConnection().createQueryRunner() await queryRunner.connect() await queryRunner.startTransaction('REPEATABLE READ') @@ -108,12 +106,10 @@ export class ContributionMessageResolver { relations: ['user'], }) if (!contribution) { - logger.error('Contribution not found') - throw new Error('Contribution not found') + throw new LogError('Contribution not found', contributionId) } if (contribution.userId === user.id) { - logger.error('Admin can not answer on own contribution') - throw new Error('Admin can not answer on own contribution') + throw new LogError('Admin can not answer on his own contribution', contributionId) } if (!contribution.user.emailContact) { contribution.user.emailContact = await UserContact.findOneOrFail({ @@ -149,8 +145,7 @@ export class ContributionMessageResolver { await queryRunner.commitTransaction() } catch (e) { await queryRunner.rollbackTransaction() - logger.error(`ContributionMessage was not successful: ${e}`) - throw new Error(`ContributionMessage was not successful: ${e}`) + throw new LogError('ContributionMessage was not sent successfully', e) } finally { await queryRunner.release() } From ab96a38dd38b3b2d9b1ebc216966a2121d7d2a4e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 3 Feb 2023 01:25:24 +0100 Subject: [PATCH 04/36] remove unused import --- backend/src/graphql/resolver/ContributionMessageResolver.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.ts b/backend/src/graphql/resolver/ContributionMessageResolver.ts index 9544f81c4..3e6f86e53 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.ts @@ -12,7 +12,6 @@ import { ContributionStatus } from '@enum/ContributionStatus' import { Order } from '@enum/Order' import Paginated from '@arg/Paginated' -import { backendLogger as logger } from '@/server/logger' import { RIGHTS } from '@/auth/RIGHTS' import { Context, getUser } from '@/server/context' import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants' From 8b502c940cf94ff4d343b22367d9d4768ae963dc Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 6 Feb 2023 15:35:11 +0100 Subject: [PATCH 05/36] Remove rebuild of admin, backend and frontend in case there tests files have been changed. --- admin/package.json | 5 ++++- backend/package.json | 3 +++ frontend/package.json | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/admin/package.json b/admin/package.json index 8270c4da6..30e93239b 100644 --- a/admin/package.json +++ b/admin/package.json @@ -86,5 +86,8 @@ "> 1%", "last 2 versions", "not ie <= 10" - ] + ], + "nodemonConfig": { + "ignore": ["**/*.spec.js"] + } } diff --git a/backend/package.json b/backend/package.json index bfcd61d5b..9a36c2ff8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -72,5 +72,8 @@ "ts-node": "^10.0.0", "tsconfig-paths": "^3.14.0", "typescript": "^4.3.4" + }, + "nodemonConfig": { + "ignore": ["**/*.test.ts"] } } diff --git a/frontend/package.json b/frontend/package.json index 29c440988..73651327f 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -104,5 +104,8 @@ ], "author": "Gradido-Akademie - https://www.gradido.net/", "license": "Apache-2.0", - "description": "Gradido, the Natural Economy of Life, is a way to worldwide prosperity and peace in harmony with nature. - Gradido, die Natürliche Ökonomie des lebens, ist ein Weg zu weltweitem Wohlstand und Frieden in Harmonie mit der Natur." + "description": "Gradido, the Natural Economy of Life, is a way to worldwide prosperity and peace in harmony with nature. - Gradido, die Natürliche Ökonomie des lebens, ist ein Weg zu weltweitem Wohlstand und Frieden in Harmonie mit der Natur.", + "nodemonConfig": { + "ignore": ["**/*.spec.js"] + } } From cb748d8c503ba8e5a99453c31e3ee6d8cb560dc1 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 6 Feb 2023 18:47:58 +0100 Subject: [PATCH 06/36] refactor(backend): get last transaction by only one function --- backend/src/graphql/resolver/BalanceResolver.ts | 4 +++- .../src/graphql/resolver/ContributionResolver.ts | 15 ++++++--------- .../graphql/resolver/TransactionLinkResolver.ts | 10 +++------- .../src/graphql/resolver/TransactionResolver.ts | 7 +++---- .../resolver/accessLayer/getLastTransaction.ts | 14 ++++++++++++++ backend/src/util/validate.ts | 4 ++-- 6 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 backend/src/graphql/resolver/accessLayer/getLastTransaction.ts diff --git a/backend/src/graphql/resolver/BalanceResolver.ts b/backend/src/graphql/resolver/BalanceResolver.ts index 26f9cd656..ae099bcde 100644 --- a/backend/src/graphql/resolver/BalanceResolver.ts +++ b/backend/src/graphql/resolver/BalanceResolver.ts @@ -15,6 +15,8 @@ import { calculateDecay } from '@/util/decay' import { RIGHTS } from '@/auth/RIGHTS' import { GdtResolver } from './GdtResolver' +import { getLastTransaction } from './accessLayer/getLastTransaction' + @Resolver() export class BalanceResolver { @Authorized([RIGHTS.BALANCE]) @@ -32,7 +34,7 @@ export class BalanceResolver { const lastTransaction = context.lastTransaction ? context.lastTransaction - : await dbTransaction.findOne({ userId: user.id }, { order: { id: 'DESC' } }) + : await getLastTransaction(user.id) logger.debug(`lastTransaction=${lastTransaction}`) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index c7946d2c8..a03453c9a 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -54,6 +54,8 @@ import { } from '@/emails/sendEmailVariants' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' +import { getLastTransaction } from './accessLayer/getLastTransaction' + @Resolver() export class ContributionResolver { @Authorized([RIGHTS.CREATE_CONTRIBUTION]) @@ -613,16 +615,11 @@ export class ContributionResolver { const queryRunner = getConnection().createQueryRunner() await queryRunner.connect() await queryRunner.startTransaction('REPEATABLE READ') // 'READ COMMITTED') - try { - const lastTransaction = await queryRunner.manager - .createQueryBuilder() - .select('transaction') - .from(DbTransaction, 'transaction') - .where('transaction.userId = :id', { id: contribution.userId }) - .orderBy('transaction.id', 'DESC') - .getOne() - logger.info('lastTransaction ID', lastTransaction ? lastTransaction.id : 'undefined') + const lastTransaction = await getLastTransaction(contribution.userId) + logger.info('lastTransaction ID', lastTransaction ? lastTransaction.id : 'undefined') + + try { let newBalance = new Decimal(0) let decay: Decay | null = null if (lastTransaction) { diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index df70b4bc9..f8f61686e 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -33,6 +33,8 @@ import { executeTransaction } from './TransactionResolver' import QueryLinkResult from '@union/QueryLinkResult' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' +import { getLastTransaction } from './accessLayer/getLastTransaction' + // TODO: do not export, test it inside the resolver export const transactionLinkCode = (date: Date): string => { const time = date.getTime().toString(16) @@ -275,13 +277,7 @@ export class TransactionLinkResolver { await queryRunner.manager.insert(DbContribution, contribution) - const lastTransaction = await queryRunner.manager - .createQueryBuilder() - .select('transaction') - .from(DbTransaction, 'transaction') - .where('transaction.userId = :id', { id: user.id }) - .orderBy('transaction.id', 'DESC') - .getOne() + const lastTransaction = await getLastTransaction(user.id) let newBalance = new Decimal(0) let decay: Decay | null = null diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 2f97596b2..2a160a1ee 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -38,6 +38,8 @@ import { findUserByEmail } from './UserResolver' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' +import { getLastTransaction } from './accessLayer/getLastTransaction' + export const executeTransaction = async ( amount: Decimal, memo: string, @@ -208,10 +210,7 @@ export class TransactionResolver { logger.info(`transactionList(user=${user.firstName}.${user.lastName}, ${user.emailId})`) // find current balance - const lastTransaction = await dbTransaction.findOne( - { userId: user.id }, - { order: { id: 'DESC' }, relations: ['contribution'] }, - ) + const lastTransaction = await getLastTransaction(user.id, ['contribution']) logger.debug(`lastTransaction=${lastTransaction}`) const balanceResolver = new BalanceResolver() diff --git a/backend/src/graphql/resolver/accessLayer/getLastTransaction.ts b/backend/src/graphql/resolver/accessLayer/getLastTransaction.ts new file mode 100644 index 000000000..5b3e862c2 --- /dev/null +++ b/backend/src/graphql/resolver/accessLayer/getLastTransaction.ts @@ -0,0 +1,14 @@ +import { Transaction as DbTransaction } from '@entity/Transaction' + +export const getLastTransaction = async ( + userId: number, + relations?: string[], +): Promise => { + return DbTransaction.findOne( + { userId }, + { + order: { balanceDate: 'DESC', id: 'DESC' }, + relations, + }, + ) +} diff --git a/backend/src/util/validate.ts b/backend/src/util/validate.ts index 397a38730..a5d7c4e5f 100644 --- a/backend/src/util/validate.ts +++ b/backend/src/util/validate.ts @@ -1,10 +1,10 @@ import { calculateDecay } from './decay' import Decimal from 'decimal.js-light' -import { Transaction } from '@entity/Transaction' import { Decay } from '@model/Decay' import { getCustomRepository } from '@dbTools/typeorm' import { TransactionLinkRepository } from '@repository/TransactionLink' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' +import { getLastTransaction } from '../graphql/resolver/accessLayer/getLastTransaction' function isStringBoolean(value: string): boolean { const lowerValue = value.toLowerCase() @@ -20,7 +20,7 @@ async function calculateBalance( time: Date, transactionLink?: dbTransactionLink | null, ): Promise<{ balance: Decimal; decay: Decay; lastTransactionId: number } | null> { - const lastTransaction = await Transaction.findOne({ userId }, { order: { id: 'DESC' } }) + const lastTransaction = await getLastTransaction(userId) if (!lastTransaction) return null const decay = calculateDecay(lastTransaction.balance, lastTransaction.balanceDate, time) From 8544eb51e9f0e1c8ca22e4fec5719cbd0b493f10 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 7 Feb 2023 07:10:01 +0100 Subject: [PATCH 07/36] Fix some lint problems. --- admin/package.json | 4 +++- frontend/package.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/admin/package.json b/admin/package.json index 30e93239b..5bb3d1cd3 100644 --- a/admin/package.json +++ b/admin/package.json @@ -88,6 +88,8 @@ "not ie <= 10" ], "nodemonConfig": { - "ignore": ["**/*.spec.js"] + "ignore": [ + "**/*.spec.js" + ] } } diff --git a/frontend/package.json b/frontend/package.json index 73651327f..bf26c7529 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -106,6 +106,8 @@ "license": "Apache-2.0", "description": "Gradido, the Natural Economy of Life, is a way to worldwide prosperity and peace in harmony with nature. - Gradido, die Natürliche Ökonomie des lebens, ist ein Weg zu weltweitem Wohlstand und Frieden in Harmonie mit der Natur.", "nodemonConfig": { - "ignore": ["**/*.spec.js"] + "ignore": [ + "**/*.spec.js" + ] } } From 0b8ac928cf38e2f8ef66996efa3c68c92048bebd Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Feb 2023 18:24:20 +0100 Subject: [PATCH 08/36] more detailed error messages --- .../ContributionMessageResolver.test.ts | 32 ++++++++++++++----- .../resolver/ContributionMessageResolver.ts | 4 +-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index 36d78c382..f3e5e865d 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -99,14 +99,18 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [new GraphQLError('ContributionMessage was not sent successfully')], + errors: [ + new GraphQLError( + 'ContributionMessage was not sent successfully: Error: Contribution not found', + ), + ], }), ) }) it('logs the error thrown', () => { expect(logger.error).toBeCalledWith( - 'ContributionMessage was not sent successfully', + 'ContributionMessage was not sent successfully: Error: Contribution not found', new Error('Contribution not found'), ) }) @@ -135,14 +139,18 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [new GraphQLError('ContributionMessage was not sent successfully')], + errors: [ + new GraphQLError( + 'ContributionMessage was not sent successfully: Error: Admin can not answer on his own contribution', + ), + ], }), ) }) it('logs the error thrown', () => { expect(logger.error).toBeCalledWith( - 'ContributionMessage was not sent successfully', + 'ContributionMessage was not sent successfully: Error: Admin can not answer on his own contribution', new Error('Admin can not answer on his own contribution'), ) }) @@ -229,14 +237,18 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [new GraphQLError('ContributionMessage was not sent successfully')], + errors: [ + new GraphQLError( + 'ContributionMessage was not sent successfully: Error: Contribution not found', + ), + ], }), ) }) it('logs the error thrown', () => { expect(logger.error).toBeCalledWith( - 'ContributionMessage was not sent successfully', + 'ContributionMessage was not sent successfully: Error: Contribution not found', new Error('Contribution not found'), ) }) @@ -257,14 +269,18 @@ describe('ContributionMessageResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [new GraphQLError('ContributionMessage was not sent successfully')], + errors: [ + new GraphQLError( + 'ContributionMessage was not sent successfully: Error: Can not send message to contribution of another user', + ), + ], }), ) }) it('logs the error thrown', () => { expect(logger.error).toBeCalledWith( - 'ContributionMessage was not sent successfully', + 'ContributionMessage was not sent successfully: Error: Can not send message to contribution of another user', new Error('Can not send message to contribution of another user'), ) }) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.ts b/backend/src/graphql/resolver/ContributionMessageResolver.ts index 3e6f86e53..4248946b1 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.ts @@ -54,7 +54,7 @@ export class ContributionMessageResolver { await queryRunner.commitTransaction() } catch (e) { await queryRunner.rollbackTransaction() - throw new LogError('ContributionMessage was not sent successfully', e) + throw new LogError(`ContributionMessage was not sent successfully: ${e}`, e) } finally { await queryRunner.release() } @@ -144,7 +144,7 @@ export class ContributionMessageResolver { await queryRunner.commitTransaction() } catch (e) { await queryRunner.rollbackTransaction() - throw new LogError('ContributionMessage was not sent successfully', e) + throw new LogError(`ContributionMessage was not sent successfully: ${e}`, e) } finally { await queryRunner.release() } From 9c282c0142ab41b486801eeb8de93a3abb03f217 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 21:09:16 +0100 Subject: [PATCH 09/36] add email template for deleted contributions --- .../templates/contributionDeleted/html.pug | 16 ++++++++++++++++ .../templates/contributionDeleted/subject.pug | 1 + 2 files changed, 17 insertions(+) create mode 100644 backend/src/emails/templates/contributionDeleted/html.pug create mode 100644 backend/src/emails/templates/contributionDeleted/subject.pug diff --git a/backend/src/emails/templates/contributionDeleted/html.pug b/backend/src/emails/templates/contributionDeleted/html.pug new file mode 100644 index 000000000..5343a9f10 --- /dev/null +++ b/backend/src/emails/templates/contributionDeleted/html.pug @@ -0,0 +1,16 @@ +doctype html +html(lang=locale) + head + title= t('emails.contributionDeleted.subject') + body + h1(style='margin-bottom: 24px;')= t('emails.contributionDeleted.subject') + #container.col + include ../hello.pug + p= t('emails.contributionDeleted.contributionDeleted', { senderFirstName, senderLastName, contributionMemo }) + p= t('emails.contributionDeleted.toSeeContributionsAndMessages') + p + = t('emails.general.linkToYourAccount') + = " " + a(href=overviewURL) #{overviewURL} + p= t('emails.general.pleaseDoNotReply') + include ../greatingFormularImprint.pug diff --git a/backend/src/emails/templates/contributionDeleted/subject.pug b/backend/src/emails/templates/contributionDeleted/subject.pug new file mode 100644 index 000000000..024588472 --- /dev/null +++ b/backend/src/emails/templates/contributionDeleted/subject.pug @@ -0,0 +1 @@ += t('emails.contributionDeleted.subject') From bd9307612f1a0be7b38dbae61bc9f0ffeb358df6 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 21:10:35 +0100 Subject: [PATCH 10/36] adapt backend locales to changes regarding denying and deleting contributuins --- backend/src/locales/de.json | 9 +++++++-- backend/src/locales/en.json | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/src/locales/de.json b/backend/src/locales/de.json index 38b53508b..304ae2adc 100644 --- a/backend/src/locales/de.json +++ b/backend/src/locales/de.json @@ -23,8 +23,13 @@ "commonGoodContributionConfirmed": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde soeben von {senderFirstName} {senderLastName} bestätigt und in deinem Gradido-Konto gutgeschrieben.", "subject": "Gradido: Dein Gemeinwohl-Beitrag wurde bestätigt" }, - "contributionRejected": { - "commonGoodContributionRejected": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde von {senderFirstName} {senderLastName} abgelehnt.", + "contributionDeleted": { + "commonGoodContributionDeleted": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde von {senderFirstName} {senderLastName} gelöscht.", + "subject": "Gradido: Dein Gemeinwohl-Beitrag wurde gelöscht", + "toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!" + }, + "contributionDenied": { + "commonGoodContributionDenied": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde von {senderFirstName} {senderLastName} abgelehnt.", "subject": "Gradido: Dein Gemeinwohl-Beitrag wurde abgelehnt", "toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!" }, diff --git a/backend/src/locales/en.json b/backend/src/locales/en.json index 5cde70d26..bdc92b2cf 100644 --- a/backend/src/locales/en.json +++ b/backend/src/locales/en.json @@ -23,6 +23,11 @@ "commonGoodContributionConfirmed": "Your public good contribution “{contributionMemo}” has just been confirmed by {senderFirstName} {senderLastName} and credited to your Gradido account.", "subject": "Gradido: Your contribution to the common good was confirmed" }, + "contributionDeleted": { + "commonGoodContributionDeleted": "Your public good contribution “{contributionMemo}” was deleted by {senderFirstName} {senderLastName}.", + "subject": "Gradido: Your common good contribution was deleted", + "toSeeContributionsAndMessages": "To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!" + }, "contributionDenied": { "commonGoodContributionDenied": "Your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.", "subject": "Gradido: Your common good contribution was rejected", From f980ca20b1e8be677a9e2bb81f210ee4c77df135 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 21:11:34 +0100 Subject: [PATCH 11/36] adapt backend's email sending to added deletion email --- backend/src/emails/sendEmailVariants.ts | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/backend/src/emails/sendEmailVariants.ts b/backend/src/emails/sendEmailVariants.ts index 681ee56af..4e3881829 100644 --- a/backend/src/emails/sendEmailVariants.ts +++ b/backend/src/emails/sendEmailVariants.ts @@ -103,6 +103,32 @@ export const sendContributionConfirmedEmail = (data: { }) } +export const sendContributionDeletedEmail = (data: { + firstName: string + lastName: string + email: string + language: string + senderFirstName: string + senderLastName: string + contributionMemo: string +}): Promise | null> => { + return sendEmailTranslated({ + receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` }, + template: 'contributionDeleted', + locals: { + firstName: data.firstName, + lastName: data.lastName, + locale: data.language, + senderFirstName: data.senderFirstName, + senderLastName: data.senderLastName, + contributionMemo: data.contributionMemo, + overviewURL: CONFIG.EMAIL_LINK_OVERVIEW, + supportEmail: CONFIG.COMMUNITY_SUPPORT_MAIL, + communityURL: CONFIG.COMMUNITY_URL, + }, + }) +} + export const sendContributionDeniedEmail = (data: { firstName: string lastName: string From 5c42ec828a6d55d1107d6a0d19dd1c7427776ea7 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 21:40:02 +0100 Subject: [PATCH 12/36] fix admin right to deny confirmation --- backend/src/auth/RIGHTS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/auth/RIGHTS.ts b/backend/src/auth/RIGHTS.ts index 98f6cf118..2d836dad5 100644 --- a/backend/src/auth/RIGHTS.ts +++ b/backend/src/auth/RIGHTS.ts @@ -45,6 +45,7 @@ export enum RIGHTS { ADMIN_CREATE_CONTRIBUTIONS = 'ADMIN_CREATE_CONTRIBUTIONS', ADMIN_UPDATE_CONTRIBUTION = 'ADMIN_UPDATE_CONTRIBUTION', ADMIN_DELETE_CONTRIBUTION = 'ADMIN_DELETE_CONTRIBUTION', + ADMIN_DENY_CONTRIBUTION = 'DENY_CONTRIBUTION', LIST_UNCONFIRMED_CONTRIBUTIONS = 'LIST_UNCONFIRMED_CONTRIBUTIONS', CONFIRM_CONTRIBUTION = 'CONFIRM_CONTRIBUTION', SEND_ACTIVATION_EMAIL = 'SEND_ACTIVATION_EMAIL', @@ -54,5 +55,4 @@ export enum RIGHTS { DELETE_CONTRIBUTION_LINK = 'DELETE_CONTRIBUTION_LINK', UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK', ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE', - DENY_CONTRIBUTION = 'DENY_CONTRIBUTION', } From 2fc2ecf5af37ed421f4721765cd1e98fd921f281 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 21:46:44 +0100 Subject: [PATCH 13/36] WIP add elements to get contribution denying working in backend --- backend/src/event/Event.ts | 7 +++ .../graphql/resolver/ContributionResolver.ts | 51 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/backend/src/event/Event.ts b/backend/src/event/Event.ts index 6a1233224..786d48eed 100644 --- a/backend/src/event/Event.ts +++ b/backend/src/event/Event.ts @@ -298,6 +298,13 @@ export class Event { return this } + public setEventAdminContributionDeny(ev: EventAdminContributionDeny): Event { + this.setByBasicCt(ev.userId, ev.contributionId, ev.amount) + this.type = EventProtocolType.ADMIN_CONTRIBUTION_DENY + + return this + } + public setEventAdminContributionUpdate(ev: EventAdminContributionUpdate): Event { this.setByBasicCt(ev.userId, ev.contributionId, ev.amount) this.type = EventProtocolType.ADMIN_CONTRIBUTION_UPDATE diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index bf80bcb4d..01a681e52 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -44,6 +44,7 @@ import { EventContributionConfirm, EventAdminContributionCreate, EventAdminContributionDelete, + EventAdminContributionDeny, EventAdminContributionUpdate, } from '@/event/Event' import { writeEvent } from '@/event/EventProtocolEmitter' @@ -559,6 +560,56 @@ export class ContributionResolver { return !!res } + @Authorized([RIGHTS.ADMIN_DENY_CONTRIBUTION]) + @Mutation(() => Boolean) + async adminDenyContribution( + @Arg('id', () => Int) id: number, + @Ctx() context: Context, + ): Promise { + const contribution = await DbContribution.findOne(id) + if (!contribution) { + 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 denied') + throw new Error('A confirmed contribution can not be denied') + } + const moderator = getUser(context) + if ( + contribution.contributionType === ContributionType.USER && + contribution.userId === moderator.id + ) { + throw new Error('Own contribution can not be denied as admin') + } + const user = await DbUser.findOneOrFail( + { id: contribution.userId }, + { relations: ['emailContact'] }, + ) + contribution.contributionStatus = ContributionStatus.DENIED + contribution.deniedBy = moderator.id + await contribution.save() + const res = await contribution.softRemove() + + const event = new Event() + const eventAdminContributionDeny = new EventAdminContributionDeny() + eventAdminContributionDeny.userId = contribution.userId + eventAdminContributionDeny.amount = contribution.amount + eventAdminContributionDeny.contributionId = contribution.id + await writeEvent(event.setEventAdminContributionDeny(eventAdminContributionDeny)) + sendContributionDeniedEmail({ + firstName: user.firstName, + lastName: user.lastName, + email: user.emailContact.email, + language: user.language, + senderFirstName: moderator.firstName, + senderLastName: moderator.lastName, + contributionMemo: contribution.memo, + }) + + return !!res + } + @Authorized([RIGHTS.CONFIRM_CONTRIBUTION]) @Mutation(() => Boolean) async confirmContribution( From 0b1d6b5237dc883ac0bd39f049c053256492c13f Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 7 Feb 2023 21:56:32 +0100 Subject: [PATCH 14/36] add deying to events and event protocol --- backend/src/event/Event.ts | 1 + backend/src/event/EventProtocolType.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/src/event/Event.ts b/backend/src/event/Event.ts index 786d48eed..77e86ad46 100644 --- a/backend/src/event/Event.ts +++ b/backend/src/event/Event.ts @@ -67,6 +67,7 @@ export class EventTransactionReceiveRedeem extends EventBasicTxX {} export class EventContributionCreate extends EventBasicCt {} export class EventAdminContributionCreate extends EventBasicCt {} export class EventAdminContributionDelete extends EventBasicCt {} +export class EventAdminContributionDeny extends EventBasicCt {} export class EventAdminContributionUpdate extends EventBasicCt {} export class EventUserCreateContributionMessage extends EventBasicCtMsg {} export class EventAdminCreateContributionMessage extends EventBasicCtMsg {} diff --git a/backend/src/event/EventProtocolType.ts b/backend/src/event/EventProtocolType.ts index b7c2f0151..ccd15d238 100644 --- a/backend/src/event/EventProtocolType.ts +++ b/backend/src/event/EventProtocolType.ts @@ -35,6 +35,7 @@ export enum EventProtocolType { CONTRIBUTION_UPDATE = 'CONTRIBUTION_UPDATE', ADMIN_CONTRIBUTION_CREATE = 'ADMIN_CONTRIBUTION_CREATE', ADMIN_CONTRIBUTION_DELETE = 'ADMIN_CONTRIBUTION_DELETE', + ADMIN_CONTRIBUTION_DENY = 'ADMIN_CONTRIBUTION_DENY', ADMIN_CONTRIBUTION_UPDATE = 'ADMIN_CONTRIBUTION_UPDATE', USER_CREATE_CONTRIBUTION_MESSAGE = 'USER_CREATE_CONTRIBUTION_MESSAGE', ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE', From cf9b06824b1324d30f972968aaab96cfa7643953 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Feb 2023 08:37:49 +0100 Subject: [PATCH 15/36] set right to deny a contribution --- backend/src/auth/RIGHTS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/auth/RIGHTS.ts b/backend/src/auth/RIGHTS.ts index 2d836dad5..98f6cf118 100644 --- a/backend/src/auth/RIGHTS.ts +++ b/backend/src/auth/RIGHTS.ts @@ -45,7 +45,6 @@ export enum RIGHTS { ADMIN_CREATE_CONTRIBUTIONS = 'ADMIN_CREATE_CONTRIBUTIONS', ADMIN_UPDATE_CONTRIBUTION = 'ADMIN_UPDATE_CONTRIBUTION', ADMIN_DELETE_CONTRIBUTION = 'ADMIN_DELETE_CONTRIBUTION', - ADMIN_DENY_CONTRIBUTION = 'DENY_CONTRIBUTION', LIST_UNCONFIRMED_CONTRIBUTIONS = 'LIST_UNCONFIRMED_CONTRIBUTIONS', CONFIRM_CONTRIBUTION = 'CONFIRM_CONTRIBUTION', SEND_ACTIVATION_EMAIL = 'SEND_ACTIVATION_EMAIL', @@ -55,4 +54,5 @@ export enum RIGHTS { DELETE_CONTRIBUTION_LINK = 'DELETE_CONTRIBUTION_LINK', UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK', ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE', + DENY_CONTRIBUTION = 'DENY_CONTRIBUTION', } From 274bd8b86413686b3e10398f5510a4e4f33bcade Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Feb 2023 08:39:11 +0100 Subject: [PATCH 16/36] set correct locale key in contribution deleted email template --- backend/src/emails/templates/contributionDeleted/html.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/emails/templates/contributionDeleted/html.pug b/backend/src/emails/templates/contributionDeleted/html.pug index 5343a9f10..d6b3ea207 100644 --- a/backend/src/emails/templates/contributionDeleted/html.pug +++ b/backend/src/emails/templates/contributionDeleted/html.pug @@ -6,7 +6,7 @@ html(lang=locale) h1(style='margin-bottom: 24px;')= t('emails.contributionDeleted.subject') #container.col include ../hello.pug - p= t('emails.contributionDeleted.contributionDeleted', { senderFirstName, senderLastName, contributionMemo }) + p= t('emails.contributionDeleted.commonGoodContributionDeleted', { senderFirstName, senderLastName, contributionMemo }) p= t('emails.contributionDeleted.toSeeContributionsAndMessages') p = t('emails.general.linkToYourAccount') From 01cca65dea9534a10840568b22965fe8e8f8cf49 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Feb 2023 08:46:36 +0100 Subject: [PATCH 17/36] finish denyContribution method in contribution resolver --- .../graphql/resolver/ContributionResolver.ts | 60 +++---------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 01a681e52..1ed424301 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -51,6 +51,7 @@ import { writeEvent } from '@/event/EventProtocolEmitter' import { calculateDecay } from '@/util/decay' import { sendContributionConfirmedEmail, + sendContributionDeletedEmail, sendContributionDeniedEmail, } from '@/emails/sendEmailVariants' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' @@ -547,57 +548,7 @@ export class ContributionResolver { eventAdminContributionDelete.amount = contribution.amount eventAdminContributionDelete.contributionId = contribution.id await writeEvent(event.setEventAdminContributionDelete(eventAdminContributionDelete)) - sendContributionDeniedEmail({ - firstName: user.firstName, - lastName: user.lastName, - email: user.emailContact.email, - language: user.language, - senderFirstName: moderator.firstName, - senderLastName: moderator.lastName, - contributionMemo: contribution.memo, - }) - - return !!res - } - - @Authorized([RIGHTS.ADMIN_DENY_CONTRIBUTION]) - @Mutation(() => Boolean) - async adminDenyContribution( - @Arg('id', () => Int) id: number, - @Ctx() context: Context, - ): Promise { - const contribution = await DbContribution.findOne(id) - if (!contribution) { - 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 denied') - throw new Error('A confirmed contribution can not be denied') - } - const moderator = getUser(context) - if ( - contribution.contributionType === ContributionType.USER && - contribution.userId === moderator.id - ) { - throw new Error('Own contribution can not be denied as admin') - } - const user = await DbUser.findOneOrFail( - { id: contribution.userId }, - { relations: ['emailContact'] }, - ) - contribution.contributionStatus = ContributionStatus.DENIED - contribution.deniedBy = moderator.id - await contribution.save() - const res = await contribution.softRemove() - - const event = new Event() - const eventAdminContributionDeny = new EventAdminContributionDeny() - eventAdminContributionDeny.userId = contribution.userId - eventAdminContributionDeny.amount = contribution.amount - eventAdminContributionDeny.contributionId = contribution.id - await writeEvent(event.setEventAdminContributionDeny(eventAdminContributionDeny)) - sendContributionDeniedEmail({ + sendContributionDeletedEmail({ firstName: user.firstName, lastName: user.lastName, email: user.emailContact.email, @@ -818,6 +769,13 @@ export class ContributionResolver { contributionToUpdate.deniedAt = new Date() const res = await contributionToUpdate.save() + const event = new Event() + const eventAdminContributionDeny = new EventAdminContributionDeny() + eventAdminContributionDeny.userId = contributionToUpdate.userId + eventAdminContributionDeny.amount = contributionToUpdate.amount + eventAdminContributionDeny.contributionId = contributionToUpdate.id + await writeEvent(event.setEventAdminContributionDeny(eventAdminContributionDeny)) + sendContributionDeniedEmail({ firstName: user.firstName, lastName: user.lastName, From c4fae48b1d9f094fc4c4f75c702fd1e91c5ae4c4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Feb 2023 09:44:21 +0100 Subject: [PATCH 18/36] toast by automatically logged out --- frontend/src/components/SessionLogoutTimeout.vue | 2 ++ frontend/src/mixins/toaster.js | 11 ++++++++++- frontend/src/pages/Login.vue | 6 ++++++ frontend/src/store/store.js | 5 +++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/SessionLogoutTimeout.vue b/frontend/src/components/SessionLogoutTimeout.vue index 1ebff752a..7a7cdfc5e 100644 --- a/frontend/src/components/SessionLogoutTimeout.vue +++ b/frontend/src/components/SessionLogoutTimeout.vue @@ -67,6 +67,7 @@ export default { } if (this.tokenExpiresInSeconds === 0) { this.$timer.stop('tokenExpires') + this.$store.commit('automaticallyLoggedOut', true) this.$emit('logout') } }, @@ -84,6 +85,7 @@ export default { }) .catch(() => { this.$timer.stop('tokenExpires') + this.$store.commit('automaticallyLoggedOut', true) this.$emit('logout') }) }, diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index 175ffeec0..109bf0d9a 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -4,24 +4,33 @@ export const toasters = { this.toast(message, { title: this.$t('success'), variant: 'success', + autoHideDelay: 5000, }) }, toastError(message) { this.toast(message, { title: this.$t('error.error'), variant: 'danger', + autoHideDelay: 5000, }) }, toastInfo(message) { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', + autoHideDelay: 5000, + }) + }, + toastInfoNoHide(message) { + this.toast(message, { + title: this.$t('navigation.info'), + variant: 'warning', + noAutoHide: true, }) }, toast(message, options) { if (message.replace) message = message.replace(/^GraphQL error: /, '') this.$root.$bvToast.toast(message, { - autoHideDelay: 5000, appendToast: true, solid: true, toaster: 'b-toaster-top-right', diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index bd07af3ef..5e2597c45 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -123,5 +123,11 @@ export default { return !this.showPageMessage }, }, + mounted() { + if (this.$store.state.automaticallyLoggedOut) { + this.toastInfoNoHide('Du wurdest automatisch abgemeldet') + this.$store.commit('automaticallyLoggedOut', false) + } + }, } diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 1cd874c06..8f87cf468 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -53,6 +53,9 @@ export const mutations = { hideAmountGDT: (state, hideAmountGDT) => { state.hideAmountGDT = !!hideAmountGDT }, + automaticallyLoggedOut: (state, automaticallyLoggedOut) => { + state.automaticallyLoggedOut = !!automaticallyLoggedOut + }, } export const actions = { @@ -68,6 +71,7 @@ export const actions = { commit('isAdmin', data.isAdmin) commit('hideAmountGDD', data.hideAmountGDD) commit('hideAmountGDT', data.hideAmountGDT) + commit('automaticallyLoggedOut', false) }, logout: ({ commit, state }) => { commit('token', null) @@ -108,6 +112,7 @@ try { publisherId: null, hideAmountGDD: null, hideAmountGDT: null, + automaticallyLoggedOut: false, }, getters: {}, // Syncronous mutation of the state From f5d986664478ec6389a61a6ee2b9d847778901d1 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 8 Feb 2023 10:33:53 +0100 Subject: [PATCH 19/36] remove accessLayer folder --- backend/src/graphql/resolver/BalanceResolver.ts | 2 +- backend/src/graphql/resolver/ContributionResolver.ts | 2 +- backend/src/graphql/resolver/TransactionLinkResolver.ts | 2 +- backend/src/graphql/resolver/TransactionResolver.ts | 2 +- .../resolver/{accessLayer => util}/getLastTransaction.ts | 0 backend/src/util/validate.ts | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename backend/src/graphql/resolver/{accessLayer => util}/getLastTransaction.ts (100%) diff --git a/backend/src/graphql/resolver/BalanceResolver.ts b/backend/src/graphql/resolver/BalanceResolver.ts index ae099bcde..65cccf4d4 100644 --- a/backend/src/graphql/resolver/BalanceResolver.ts +++ b/backend/src/graphql/resolver/BalanceResolver.ts @@ -15,7 +15,7 @@ import { calculateDecay } from '@/util/decay' import { RIGHTS } from '@/auth/RIGHTS' import { GdtResolver } from './GdtResolver' -import { getLastTransaction } from './accessLayer/getLastTransaction' +import { getLastTransaction } from './util/getLastTransaction' @Resolver() export class BalanceResolver { diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index a03453c9a..474e38cf9 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -54,7 +54,7 @@ import { } from '@/emails/sendEmailVariants' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' -import { getLastTransaction } from './accessLayer/getLastTransaction' +import { getLastTransaction } from './util/getLastTransaction' @Resolver() export class ContributionResolver { diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index f8f61686e..b3376c65f 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -33,7 +33,7 @@ import { executeTransaction } from './TransactionResolver' import QueryLinkResult from '@union/QueryLinkResult' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' -import { getLastTransaction } from './accessLayer/getLastTransaction' +import { getLastTransaction } from './util/getLastTransaction' // TODO: do not export, test it inside the resolver export const transactionLinkCode = (date: Date): string => { diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 2a160a1ee..bc3ce4880 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -38,7 +38,7 @@ import { findUserByEmail } from './UserResolver' import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' -import { getLastTransaction } from './accessLayer/getLastTransaction' +import { getLastTransaction } from './util/getLastTransaction' export const executeTransaction = async ( amount: Decimal, diff --git a/backend/src/graphql/resolver/accessLayer/getLastTransaction.ts b/backend/src/graphql/resolver/util/getLastTransaction.ts similarity index 100% rename from backend/src/graphql/resolver/accessLayer/getLastTransaction.ts rename to backend/src/graphql/resolver/util/getLastTransaction.ts diff --git a/backend/src/util/validate.ts b/backend/src/util/validate.ts index a5d7c4e5f..482e9eb50 100644 --- a/backend/src/util/validate.ts +++ b/backend/src/util/validate.ts @@ -4,7 +4,7 @@ import { Decay } from '@model/Decay' import { getCustomRepository } from '@dbTools/typeorm' import { TransactionLinkRepository } from '@repository/TransactionLink' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' -import { getLastTransaction } from '../graphql/resolver/accessLayer/getLastTransaction' +import { getLastTransaction } from '../graphql/resolver/util/getLastTransaction' function isStringBoolean(value: string): boolean { const lowerValue = value.toLowerCase() From 687ae6e877b0cb72a3c1849e051a56c749222b63 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Feb 2023 13:22:44 +0100 Subject: [PATCH 20/36] remove commented unused code --- backend/src/graphql/resolver/ContributionResolver.test.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index d48502c69..efea67506 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -22,11 +22,7 @@ import { listContributions, listUnconfirmedContributions, } from '@/seeds/graphql/queries' -import { - // sendAccountActivationEmail, - sendContributionConfirmedEmail, - // sendContributionRejectedEmail, -} from '@/emails/sendEmailVariants' +import { sendContributionConfirmedEmail } from '@/emails/sendEmailVariants' import { cleanDB, resetToken, From b4b180a1d1ec7d0e680dfceec8760722dd7e9a88 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Feb 2023 13:22:44 +0100 Subject: [PATCH 21/36] remove commented unused code --- backend/src/graphql/resolver/ContributionResolver.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index efea67506..03ad002ad 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -43,7 +43,6 @@ import { EventProtocolType } from '@/event/EventProtocolType' import { logger, i18n as localization } from '@test/testSetup' import { UserInputError } from 'apollo-server-express' -// mock account activation email to avoid console spam // mock account activation email to avoid console spam jest.mock('@/emails/sendEmailVariants', () => { const originalModule = jest.requireActual('@/emails/sendEmailVariants') From 7fa34ab56a9d7993cb67bdaa86b9812038e67d90 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 8 Feb 2023 18:17:14 +0100 Subject: [PATCH 22/36] adapt unit tests tu changes on email variants in backend --- backend/src/emails/sendEmailVariants.test.ts | 79 ++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index ddbc387a1..7e499feb9 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -10,6 +10,7 @@ import { sendAccountMultiRegistrationEmail, sendContributionConfirmedEmail, sendContributionDeniedEmail, + sendContributionDeletedEmail, sendResetPasswordEmail, sendTransactionLinkRedeemedEmail, sendTransactionReceivedEmail, @@ -438,6 +439,84 @@ describe('sendEmailVariants', () => { }) }) + describe('sendContributionDeletedEmail', () => { + beforeAll(async () => { + result = await sendContributionDeletedEmail({ + firstName: 'Peter', + lastName: 'Lustig', + email: 'peter@lustig.de', + language: 'en', + senderFirstName: 'Bibi', + senderLastName: 'Bloxberg', + contributionMemo: 'My contribution.', + }) + }) + + describe('calls "sendEmailTranslated"', () => { + it('with expected parameters', () => { + expect(sendEmailTranslated).toBeCalledWith({ + receiver: { + to: 'Peter Lustig ', + }, + template: 'contributionDeleted', + locals: { + firstName: 'Peter', + lastName: 'Lustig', + locale: 'en', + senderFirstName: 'Bibi', + senderLastName: 'Bloxberg', + contributionMemo: 'My contribution.', + overviewURL: CONFIG.EMAIL_LINK_OVERVIEW, + supportEmail: CONFIG.COMMUNITY_SUPPORT_MAIL, + communityURL: CONFIG.COMMUNITY_URL, + }, + }) + }) + + it('has expected result', () => { + expect(result).toMatchObject({ + envelope: { + from: 'info@gradido.net', + to: ['peter@lustig.de'], + }, + message: expect.any(String), + originalMessage: expect.objectContaining({ + to: 'Peter Lustig ', + from: 'Gradido (do not answer) ', + attachments: [], + subject: 'Gradido: Your common good contribution was deleted', + html: expect.any(String), + text: expect.stringContaining('GRADIDO: YOUR COMMON GOOD CONTRIBUTION WAS DELETED'), + }), + }) + expect(result.originalMessage.html).toContain('') + expect(result.originalMessage.html).toContain('') + expect(result.originalMessage.html).toContain( + 'Gradido: Your common good contribution was deleted', + ) + expect(result.originalMessage.html).toContain( + '>Gradido: Your common good contribution was deleted', + ) + expect(result.originalMessage.html).toContain('Hello Peter Lustig') + expect(result.originalMessage.html).toContain( + 'Your public good contribution “My contribution.” was deleted by Bibi Bloxberg.', + ) + expect(result.originalMessage.html).toContain( + 'To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!', + ) + expect(result.originalMessage.html).toContain( + `Link to your account: ${CONFIG.EMAIL_LINK_OVERVIEW}`, + ) + expect(result.originalMessage.html).toContain('Please do not reply to this email!') + expect(result.originalMessage.html).toContain('Kind regards,
your Gradido team') + expect(result.originalMessage.html).toContain('—————') + expect(result.originalMessage.html).toContain( + '
Gradido-Akademie Logo

Gradido-Akademie
Institut für Wirtschaftsbionik
Pfarrweg 2
74653 Künzelsau
Deutschland
support@supportmail.com
http://localhost/', + ) + }) + }) + }) + describe('sendResetPasswordEmail', () => { beforeAll(async () => { result = await sendResetPasswordEmail({ From 163c840446a01a7e105c53433fab8aac4ccb764d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 9 Feb 2023 14:00:23 +0100 Subject: [PATCH 23/36] remove config version from .env.dist --- backend/.env.dist | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/.env.dist b/backend/.env.dist index 3e54b0566..8cf89ff0c 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -1,5 +1,3 @@ -CONFIG_VERSION=v14.2022-12-22 - # Server PORT=4000 JWT_SECRET=secret123 From a04a498882344c4b9be0756829740d41be1007b6 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 9 Feb 2023 14:02:11 +0100 Subject: [PATCH 24/36] remove config version from all .env.dist --- admin/.env.dist | 2 -- database/.env.dist | 2 -- dht-node/.env.dist | 2 -- frontend/.env.dist | 2 -- 4 files changed, 8 deletions(-) diff --git a/admin/.env.dist b/admin/.env.dist index d7044669a..66c84dda8 100644 --- a/admin/.env.dist +++ b/admin/.env.dist @@ -1,5 +1,3 @@ -CONFIG_VERSION=v1.2022-03-18 - GRAPHQL_URI=http://localhost:4000/graphql WALLET_AUTH_URL=http://localhost/authenticate?token={token} WALLET_URL=http://localhost/login diff --git a/database/.env.dist b/database/.env.dist index 58362a7b9..689e4f509 100644 --- a/database/.env.dist +++ b/database/.env.dist @@ -1,5 +1,3 @@ -CONFIG_VERSION=v1.2022-03-18 - DB_HOST=localhost DB_PORT=3306 DB_USER=root diff --git a/dht-node/.env.dist b/dht-node/.env.dist index 09e25ccb6..e005ca748 100644 --- a/dht-node/.env.dist +++ b/dht-node/.env.dist @@ -1,5 +1,3 @@ -CONFIG_VERSION=v1.2023-01-01 - # Database DB_HOST=localhost DB_PORT=3306 diff --git a/frontend/.env.dist b/frontend/.env.dist index 5ce6b430d..427d43359 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,5 +1,3 @@ -CONFIG_VERSION=v4.2022-12-20 - # Environment DEFAULT_PUBLISHER_ID=2896 From af47bf847ba1d008e9675faf81cab0770c637e79 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Feb 2023 16:19:21 +0100 Subject: [PATCH 25/36] remove store way --- frontend/src/components/SessionLogoutTimeout.vue | 4 ++-- frontend/src/pages/Login.vue | 6 ------ frontend/src/store/store.js | 5 ----- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/SessionLogoutTimeout.vue b/frontend/src/components/SessionLogoutTimeout.vue index 7a7cdfc5e..a41da851e 100644 --- a/frontend/src/components/SessionLogoutTimeout.vue +++ b/frontend/src/components/SessionLogoutTimeout.vue @@ -67,7 +67,7 @@ export default { } if (this.tokenExpiresInSeconds === 0) { this.$timer.stop('tokenExpires') - this.$store.commit('automaticallyLoggedOut', true) + this.toastInfoNoHide('Du wurdest automatisch abgemeldet') this.$emit('logout') } }, @@ -85,7 +85,7 @@ export default { }) .catch(() => { this.$timer.stop('tokenExpires') - this.$store.commit('automaticallyLoggedOut', true) + this.toastInfoNoHide('Du wurdest automatisch abgemeldet') this.$emit('logout') }) }, diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index 5e2597c45..bd07af3ef 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -123,11 +123,5 @@ export default { return !this.showPageMessage }, }, - mounted() { - if (this.$store.state.automaticallyLoggedOut) { - this.toastInfoNoHide('Du wurdest automatisch abgemeldet') - this.$store.commit('automaticallyLoggedOut', false) - } - }, } diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 8f87cf468..1cd874c06 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -53,9 +53,6 @@ export const mutations = { hideAmountGDT: (state, hideAmountGDT) => { state.hideAmountGDT = !!hideAmountGDT }, - automaticallyLoggedOut: (state, automaticallyLoggedOut) => { - state.automaticallyLoggedOut = !!automaticallyLoggedOut - }, } export const actions = { @@ -71,7 +68,6 @@ export const actions = { commit('isAdmin', data.isAdmin) commit('hideAmountGDD', data.hideAmountGDD) commit('hideAmountGDT', data.hideAmountGDT) - commit('automaticallyLoggedOut', false) }, logout: ({ commit, state }) => { commit('token', null) @@ -112,7 +108,6 @@ try { publisherId: null, hideAmountGDD: null, hideAmountGDT: null, - automaticallyLoggedOut: false, }, getters: {}, // Syncronous mutation of the state From 12e7b9cce3fb2cf791d4778f7239fd1b7ce68da0 Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Thu, 9 Feb 2023 16:38:11 +0100 Subject: [PATCH 26/36] Update frontend/src/mixins/toaster.js Co-authored-by: Moriz Wahl --- frontend/src/mixins/toaster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index 109bf0d9a..3d180dd61 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -21,7 +21,7 @@ export const toasters = { autoHideDelay: 5000, }) }, - toastInfoNoHide(message) { + toastInfoNoHide(message, { noAutoHide: true }) { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', From c7e3425f29663eba5f073a9eab3f1a3bef88d3ac Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Thu, 9 Feb 2023 16:38:31 +0100 Subject: [PATCH 27/36] Update frontend/src/mixins/toaster.js Co-authored-by: Moriz Wahl --- frontend/src/mixins/toaster.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index 3d180dd61..c5c0f0204 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -25,7 +25,6 @@ export const toasters = { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', - noAutoHide: true, }) }, toast(message, options) { From f12da2c7ade8f49aac5a84fe55d0d09e042c8edd Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Thu, 9 Feb 2023 16:38:44 +0100 Subject: [PATCH 28/36] Update frontend/src/mixins/toaster.js Co-authored-by: Moriz Wahl --- frontend/src/mixins/toaster.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index c5c0f0204..8a2b2f812 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -18,7 +18,6 @@ export const toasters = { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', - autoHideDelay: 5000, }) }, toastInfoNoHide(message, { noAutoHide: true }) { From 77c72b00d97dc216f0b9acc7586e819efa113b7e Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Thu, 9 Feb 2023 16:38:54 +0100 Subject: [PATCH 29/36] Update frontend/src/mixins/toaster.js Co-authored-by: Moriz Wahl --- frontend/src/mixins/toaster.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index 8a2b2f812..d2b4ad6fb 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -4,7 +4,6 @@ export const toasters = { this.toast(message, { title: this.$t('success'), variant: 'success', - autoHideDelay: 5000, }) }, toastError(message) { From b7740e5351caa7364f14edeecdf2dbfaa2626add Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Feb 2023 16:49:19 +0100 Subject: [PATCH 30/36] remove code --- frontend/src/mixins/toaster.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index d2b4ad6fb..109bf0d9a 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -4,6 +4,7 @@ export const toasters = { this.toast(message, { title: this.$t('success'), variant: 'success', + autoHideDelay: 5000, }) }, toastError(message) { @@ -17,12 +18,14 @@ export const toasters = { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', + autoHideDelay: 5000, }) }, - toastInfoNoHide(message, { noAutoHide: true }) { + toastInfoNoHide(message) { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', + noAutoHide: true, }) }, toast(message, options) { From 72e0e90e2ef6ecf6351f8d3b76e87d342ab9fdcb Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Feb 2023 16:53:44 +0100 Subject: [PATCH 31/36] remove code 2 --- frontend/src/mixins/toaster.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js index 109bf0d9a..6ed73b697 100644 --- a/frontend/src/mixins/toaster.js +++ b/frontend/src/mixins/toaster.js @@ -4,21 +4,18 @@ export const toasters = { this.toast(message, { title: this.$t('success'), variant: 'success', - autoHideDelay: 5000, }) }, toastError(message) { this.toast(message, { title: this.$t('error.error'), variant: 'danger', - autoHideDelay: 5000, }) }, toastInfo(message) { this.toast(message, { title: this.$t('navigation.info'), variant: 'warning', - autoHideDelay: 5000, }) }, toastInfoNoHide(message) { @@ -32,6 +29,7 @@ export const toasters = { if (message.replace) message = message.replace(/^GraphQL error: /, '') this.$root.$bvToast.toast(message, { appendToast: true, + autoHideDelay: 5000, solid: true, toaster: 'b-toaster-top-right', headerClass: 'gdd-toaster-title', From bacac0c93da361da16cccc248cda02270328d6c7 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Feb 2023 17:02:01 +0100 Subject: [PATCH 32/36] add locales --- frontend/src/components/SessionLogoutTimeout.vue | 4 ++-- frontend/src/locales/de.json | 3 ++- frontend/src/locales/en.json | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/SessionLogoutTimeout.vue b/frontend/src/components/SessionLogoutTimeout.vue index a41da851e..7a11d1d83 100644 --- a/frontend/src/components/SessionLogoutTimeout.vue +++ b/frontend/src/components/SessionLogoutTimeout.vue @@ -67,7 +67,7 @@ export default { } if (this.tokenExpiresInSeconds === 0) { this.$timer.stop('tokenExpires') - this.toastInfoNoHide('Du wurdest automatisch abgemeldet') + this.toastInfoNoHide(this.$t('session.automaticallyLoggedOut')) this.$emit('logout') } }, @@ -85,7 +85,7 @@ export default { }) .catch(() => { this.$timer.stop('tokenExpires') - this.toastInfoNoHide('Du wurdest automatisch abgemeldet') + this.toastInfoNoHide(this.$t('session.automaticallyLoggedOut')) this.$emit('logout') }) }, diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index eff4237ca..4563db397 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -275,7 +275,8 @@ "extend": "Angemeldet bleiben", "lightText": "Wenn du länger als 10 Minuten keine Aktion getätigt hast, wirst du aus Sicherheitsgründen abgemeldet.", "logoutIn": "Abmelden in ", - "warningText": "Bist du noch da?" + "warningText": "Bist du noch da?", + "automaticallyLoggedOut":"Du wurdest automatisch abgemeldet" }, "settings": { "hideAmountGDD": "Dein GDD Betrag ist versteckt.", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 068282891..50a8e45a1 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -275,7 +275,8 @@ "extend": "Stay logged in", "lightText": "If you have not performed any action for more than 10 minutes, you will be logged out for security reasons.", "logoutIn": "Log out in ", - "warningText": "Are you still there?" + "warningText": "Are you still there?", + "automaticallyLoggedOut":"You have been automatically logged out." }, "settings": { "hideAmountGDD": "Your GDD amount is hidden.", From 3c93b5a5b49b11070e0b7e75975e23268c4fe6a4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Feb 2023 17:03:23 +0100 Subject: [PATCH 33/36] fix lint --- 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 4563db397..04d49ed82 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -276,7 +276,7 @@ "lightText": "Wenn du länger als 10 Minuten keine Aktion getätigt hast, wirst du aus Sicherheitsgründen abgemeldet.", "logoutIn": "Abmelden in ", "warningText": "Bist du noch da?", - "automaticallyLoggedOut":"Du wurdest automatisch abgemeldet" + "automaticallyLoggedOut": "Du wurdest automatisch abgemeldet" }, "settings": { "hideAmountGDD": "Dein GDD Betrag ist versteckt.", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 50a8e45a1..360325c8f 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -276,7 +276,7 @@ "lightText": "If you have not performed any action for more than 10 minutes, you will be logged out for security reasons.", "logoutIn": "Log out in ", "warningText": "Are you still there?", - "automaticallyLoggedOut":"You have been automatically logged out." + "automaticallyLoggedOut": "You have been automatically logged out." }, "settings": { "hideAmountGDD": "Your GDD amount is hidden.", From 1c8a9efc503a04bfccd2e6cea37355e323ffebe8 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Feb 2023 17:03:41 +0100 Subject: [PATCH 34/36] fix locales --- frontend/src/locales/de.json | 4 ++-- frontend/src/locales/en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 04d49ed82..016698abc 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -272,11 +272,11 @@ "send_gdd": "GDD versenden", "send_per_link": "GDD versenden per Link", "session": { + "automaticallyLoggedOut": "Du wurdest automatisch abgemeldet", "extend": "Angemeldet bleiben", "lightText": "Wenn du länger als 10 Minuten keine Aktion getätigt hast, wirst du aus Sicherheitsgründen abgemeldet.", "logoutIn": "Abmelden in ", - "warningText": "Bist du noch da?", - "automaticallyLoggedOut": "Du wurdest automatisch abgemeldet" + "warningText": "Bist du noch da?" }, "settings": { "hideAmountGDD": "Dein GDD Betrag ist versteckt.", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 360325c8f..d95187b41 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -272,11 +272,11 @@ "send_gdd": "Send GDD", "send_per_link": "Send GDD via Link", "session": { + "automaticallyLoggedOut": "You have been automatically logged out.", "extend": "Stay logged in", "lightText": "If you have not performed any action for more than 10 minutes, you will be logged out for security reasons.", "logoutIn": "Log out in ", - "warningText": "Are you still there?", - "automaticallyLoggedOut": "You have been automatically logged out." + "warningText": "Are you still there?" }, "settings": { "hideAmountGDD": "Your GDD amount is hidden.", From 218ad21e4f65afc02c05915db05a7448d2a8460c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 9 Feb 2023 17:29:17 +0100 Subject: [PATCH 35/36] raise coverage eliminate warnings --- .../Contributions/ContributionList.spec.js | 10 ++++++++++ frontend/src/pages/Community.spec.js | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/frontend/src/components/Contributions/ContributionList.spec.js b/frontend/src/components/Contributions/ContributionList.spec.js index a1dfc934d..de875cf74 100644 --- a/frontend/src/components/Contributions/ContributionList.spec.js +++ b/frontend/src/components/Contributions/ContributionList.spec.js @@ -116,5 +116,15 @@ describe('ContributionList', () => { expect(wrapper.emitted('delete-contribution')).toEqual([[{ id: 2 }]]) }) }) + + describe('update status', () => { + beforeEach(() => { + wrapper.findComponent({ name: 'ContributionListItem' }).vm.$emit('update-state', { id: 2 }) + }) + + it('emits update status', () => { + expect(wrapper.emitted('update-state')).toEqual([[{ id: 2 }]]) + }) + }) }) }) diff --git a/frontend/src/pages/Community.spec.js b/frontend/src/pages/Community.spec.js index ecfc01716..b4d1677df 100644 --- a/frontend/src/pages/Community.spec.js +++ b/frontend/src/pages/Community.spec.js @@ -70,6 +70,8 @@ describe('Community', () => { lastName: 'Bloxberg', state: 'IN_PROGRESS', messagesCount: 0, + deniedAt: null, + deniedBy: null, }, { id: 1550, @@ -84,6 +86,8 @@ describe('Community', () => { lastName: 'Bloxberg', state: 'CONFIRMED', messagesCount: 0, + deniedAt: null, + deniedBy: null, }, ], contributionCount: 1, @@ -112,6 +116,10 @@ describe('Community', () => { confirmedAt: null, firstName: 'Bibi', lastName: 'Bloxberg', + deniedAt: null, + deniedBy: null, + messagesCount: 0, + state: 'IN_PROGRESS', }, { id: 1550, @@ -124,7 +132,10 @@ describe('Community', () => { firstName: 'Bibi', contributionDate: '2022-06-15T08:47:06.000Z', lastName: 'Bloxberg', + deniedAt: null, + deniedBy: null, messagesCount: 0, + state: 'IN_PROGRESS', }, { id: 1556, @@ -137,6 +148,10 @@ describe('Community', () => { confirmedAt: null, firstName: 'Bob', lastName: 'der Baumeister', + deniedAt: null, + deniedBy: null, + messagesCount: 0, + state: 'IN_PROGRESS', }, ], contributionCount: 3, From 7469a3caac78f70c80f28f3843f6417dd37bfc81 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 9 Feb 2023 17:52:48 +0100 Subject: [PATCH 36/36] feat(release): version 1.18.0 --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ admin/package.json | 2 +- backend/package.json | 6 ++++-- database/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 358e4670a..706caed8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,42 @@ 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.18.0](https://github.com/gradido/gradido/compare/1.17.1...1.18.0) + +- refactor(frontend): toast by automatically logged out [`#2681`](https://github.com/gradido/gradido/pull/2681) +- refactor(frontend): change text for gdd_per_link.choose-amount [`#2638`](https://github.com/gradido/gradido/pull/2638) +- fix(backend): emails for deny and delete contribution [`#2688`](https://github.com/gradido/gradido/pull/2688) +- refactor(other): remove config version from `.env.dist` [`#2686`](https://github.com/gradido/gradido/pull/2686) +- refactor(backend): use LogError on contributionMessageResolver [`#2663`](https://github.com/gradido/gradido/pull/2663) +- refactor(backend): get last transaction by only one function [`#2668`](https://github.com/gradido/gradido/pull/2668) +- refactor(other): don't rebuild modul if unit test file has been changed [`#2667`](https://github.com/gradido/gradido/pull/2667) +- refactor(backend): use LogError on contributionLinkResolver [`#2662`](https://github.com/gradido/gradido/pull/2662) +- refactor(backend): remove event protocol config switch [`#2670`](https://github.com/gradido/gradido/pull/2670) +- refactor(backend): event protocol [`#2652`](https://github.com/gradido/gradido/pull/2652) +- refactor(frontend): sidebar becomes smaller when critical phase [`#2649`](https://github.com/gradido/gradido/pull/2649) +- refactor(backend): use LogError on sendEMailTranslated [`#2656`](https://github.com/gradido/gradido/pull/2656) +- refactor(backend): log error class [`#2640`](https://github.com/gradido/gradido/pull/2640) +- feat(backend): add filterState parameter to listAllContributions query [`#2619`](https://github.com/gradido/gradido/pull/2619) +- refactor(frontend): there is no message when a month is fully created [`#2626`](https://github.com/gradido/gradido/pull/2626) +- refactor(frontend): better text alignment on send via link [`#2637`](https://github.com/gradido/gradido/pull/2637) +- refactor(frontend): text changed as indicated in the issues [`#2642`](https://github.com/gradido/gradido/pull/2642) +- refactor(frontend): when you click on create, you will be directed to the form [`#2645`](https://github.com/gradido/gradido/pull/2645) +- feat(backend): federation: separated dht-hub features in new dht-node modul [`#2510`](https://github.com/gradido/gradido/pull/2510) +- refactor(backend): refine assembly of error message in user resolver [`#2636`](https://github.com/gradido/gradido/pull/2636) +- fix(backend): unit tests creations for 31st day [`#2641`](https://github.com/gradido/gradido/pull/2641) +- fix(workflow): properly lint pr - prevent requirement to restart linting [`#2635`](https://github.com/gradido/gradido/pull/2635) +- feat(frontend): 'yes'-button shows which dialog is currently open with a different color [`#2629`](https://github.com/gradido/gradido/pull/2629) +- feat(backend): federation implement multiple apollo graphql endpoints [`#2459`](https://github.com/gradido/gradido/pull/2459) +- refactor(frontend): add legend to all contribution tab, and add tests. [`#2625`](https://github.com/gradido/gradido/pull/2625) +- feat(frontend): unit tests community page [`#2587`](https://github.com/gradido/gradido/pull/2587) +- feat(backend): deny contributions [`#2461`](https://github.com/gradido/gradido/pull/2461) +- refactor(admin): update yarn.lock file of admin. [`#2579`](https://github.com/gradido/gradido/pull/2579) + #### [1.17.1](https://github.com/gradido/gradido/compare/1.17.0...1.17.1) +> 20 January 2023 + +- chore(release): v1.17.1 [`#2588`](https://github.com/gradido/gradido/pull/2588) - refactor(frontend): change contribution memo add word-break [`#2583`](https://github.com/gradido/gradido/pull/2583) - refactor(admin): add text-break on all table memo fields [`#2584`](https://github.com/gradido/gradido/pull/2584) - fix(frontend): throw proper frontend warning errors [`#2586`](https://github.com/gradido/gradido/pull/2586) diff --git a/admin/package.json b/admin/package.json index 5bb3d1cd3..c8cccefd5 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.17.1", + "version": "1.18.0", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index 9a36c2ff8..f58a1ddd3 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.17.1", + "version": "1.18.0", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", @@ -74,6 +74,8 @@ "typescript": "^4.3.4" }, "nodemonConfig": { - "ignore": ["**/*.test.ts"] + "ignore": [ + "**/*.test.ts" + ] } } diff --git a/database/package.json b/database/package.json index f4e1c7e84..28790eae8 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.17.1", + "version": "1.18.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 bf26c7529..041b5a8e2 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.17.1", + "version": "1.18.0", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index 7a01da338..3728e6283 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.17.1", + "version": "1.18.0", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",