mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into 2675-Toast-Message-when-forced-to-logout-clientside
This commit is contained in:
commit
1de7c50055
@ -1,5 +1,3 @@
|
|||||||
CONFIG_VERSION=v1.2022-03-18
|
|
||||||
|
|
||||||
GRAPHQL_URI=http://localhost:4000/graphql
|
GRAPHQL_URI=http://localhost:4000/graphql
|
||||||
WALLET_AUTH_URL=http://localhost/authenticate?token={token}
|
WALLET_AUTH_URL=http://localhost/authenticate?token={token}
|
||||||
WALLET_URL=http://localhost/login
|
WALLET_URL=http://localhost/login
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
CONFIG_VERSION=v14.2022-12-22
|
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
PORT=4000
|
PORT=4000
|
||||||
JWT_SECRET=secret123
|
JWT_SECRET=secret123
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import {
|
|||||||
sendAccountMultiRegistrationEmail,
|
sendAccountMultiRegistrationEmail,
|
||||||
sendContributionConfirmedEmail,
|
sendContributionConfirmedEmail,
|
||||||
sendContributionDeniedEmail,
|
sendContributionDeniedEmail,
|
||||||
|
sendContributionDeletedEmail,
|
||||||
sendResetPasswordEmail,
|
sendResetPasswordEmail,
|
||||||
sendTransactionLinkRedeemedEmail,
|
sendTransactionLinkRedeemedEmail,
|
||||||
sendTransactionReceivedEmail,
|
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 <peter@lustig.de>',
|
||||||
|
},
|
||||||
|
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 <peter@lustig.de>',
|
||||||
|
from: 'Gradido (do not answer) <info@gradido.net>',
|
||||||
|
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('<!DOCTYPE html>')
|
||||||
|
expect(result.originalMessage.html).toContain('<html lang="en">')
|
||||||
|
expect(result.originalMessage.html).toContain(
|
||||||
|
'<title>Gradido: Your common good contribution was deleted</title>',
|
||||||
|
)
|
||||||
|
expect(result.originalMessage.html).toContain(
|
||||||
|
'>Gradido: Your common good contribution was deleted</h1>',
|
||||||
|
)
|
||||||
|
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: <a href="${CONFIG.EMAIL_LINK_OVERVIEW}">${CONFIG.EMAIL_LINK_OVERVIEW}</a>`,
|
||||||
|
)
|
||||||
|
expect(result.originalMessage.html).toContain('Please do not reply to this email!')
|
||||||
|
expect(result.originalMessage.html).toContain('Kind regards,<br>your Gradido team')
|
||||||
|
expect(result.originalMessage.html).toContain('—————')
|
||||||
|
expect(result.originalMessage.html).toContain(
|
||||||
|
'<div style="position: relative; left: -22px;"><img src="https://gdd.gradido.net/img/brand/green.png" width="200" alt="Gradido-Akademie Logo"></div><br>Gradido-Akademie<br>Institut für Wirtschaftsbionik<br>Pfarrweg 2<br>74653 Künzelsau<br>Deutschland<br><a href="mailto:support@supportmail.com">support@supportmail.com</a><br><a href="http://localhost/">http://localhost/</a>',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('sendResetPasswordEmail', () => {
|
describe('sendResetPasswordEmail', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
result = await sendResetPasswordEmail({
|
result = await sendResetPasswordEmail({
|
||||||
|
|||||||
@ -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<Record<string, unknown> | 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: {
|
export const sendContributionDeniedEmail = (data: {
|
||||||
firstName: string
|
firstName: string
|
||||||
lastName: string
|
lastName: string
|
||||||
|
|||||||
16
backend/src/emails/templates/contributionDeleted/html.pug
Normal file
16
backend/src/emails/templates/contributionDeleted/html.pug
Normal file
@ -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.commonGoodContributionDeleted', { 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
|
||||||
@ -0,0 +1 @@
|
|||||||
|
= t('emails.contributionDeleted.subject')
|
||||||
@ -67,6 +67,7 @@ export class EventTransactionReceiveRedeem extends EventBasicTxX {}
|
|||||||
export class EventContributionCreate extends EventBasicCt {}
|
export class EventContributionCreate extends EventBasicCt {}
|
||||||
export class EventAdminContributionCreate extends EventBasicCt {}
|
export class EventAdminContributionCreate extends EventBasicCt {}
|
||||||
export class EventAdminContributionDelete extends EventBasicCt {}
|
export class EventAdminContributionDelete extends EventBasicCt {}
|
||||||
|
export class EventAdminContributionDeny extends EventBasicCt {}
|
||||||
export class EventAdminContributionUpdate extends EventBasicCt {}
|
export class EventAdminContributionUpdate extends EventBasicCt {}
|
||||||
export class EventUserCreateContributionMessage extends EventBasicCtMsg {}
|
export class EventUserCreateContributionMessage extends EventBasicCtMsg {}
|
||||||
export class EventAdminCreateContributionMessage extends EventBasicCtMsg {}
|
export class EventAdminCreateContributionMessage extends EventBasicCtMsg {}
|
||||||
@ -298,6 +299,13 @@ export class Event {
|
|||||||
return this
|
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 {
|
public setEventAdminContributionUpdate(ev: EventAdminContributionUpdate): Event {
|
||||||
this.setByBasicCt(ev.userId, ev.contributionId, ev.amount)
|
this.setByBasicCt(ev.userId, ev.contributionId, ev.amount)
|
||||||
this.type = EventProtocolType.ADMIN_CONTRIBUTION_UPDATE
|
this.type = EventProtocolType.ADMIN_CONTRIBUTION_UPDATE
|
||||||
|
|||||||
@ -35,6 +35,7 @@ export enum EventProtocolType {
|
|||||||
CONTRIBUTION_UPDATE = 'CONTRIBUTION_UPDATE',
|
CONTRIBUTION_UPDATE = 'CONTRIBUTION_UPDATE',
|
||||||
ADMIN_CONTRIBUTION_CREATE = 'ADMIN_CONTRIBUTION_CREATE',
|
ADMIN_CONTRIBUTION_CREATE = 'ADMIN_CONTRIBUTION_CREATE',
|
||||||
ADMIN_CONTRIBUTION_DELETE = 'ADMIN_CONTRIBUTION_DELETE',
|
ADMIN_CONTRIBUTION_DELETE = 'ADMIN_CONTRIBUTION_DELETE',
|
||||||
|
ADMIN_CONTRIBUTION_DENY = 'ADMIN_CONTRIBUTION_DENY',
|
||||||
ADMIN_CONTRIBUTION_UPDATE = 'ADMIN_CONTRIBUTION_UPDATE',
|
ADMIN_CONTRIBUTION_UPDATE = 'ADMIN_CONTRIBUTION_UPDATE',
|
||||||
USER_CREATE_CONTRIBUTION_MESSAGE = 'USER_CREATE_CONTRIBUTION_MESSAGE',
|
USER_CREATE_CONTRIBUTION_MESSAGE = 'USER_CREATE_CONTRIBUTION_MESSAGE',
|
||||||
ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE',
|
ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE',
|
||||||
|
|||||||
@ -88,6 +88,7 @@ describe('ContributionMessageResolver', () => {
|
|||||||
|
|
||||||
describe('input not valid', () => {
|
describe('input not valid', () => {
|
||||||
it('throws error when contribution does not exist', async () => {
|
it('throws error when contribution does not exist', async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
await expect(
|
await expect(
|
||||||
mutate({
|
mutate({
|
||||||
mutation: adminCreateContributionMessage,
|
mutation: adminCreateContributionMessage,
|
||||||
@ -100,14 +101,22 @@ describe('ContributionMessageResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [
|
errors: [
|
||||||
new GraphQLError(
|
new GraphQLError(
|
||||||
'ContributionMessage was not successful: Error: Contribution not found',
|
'ContributionMessage was not sent successfully: Error: Contribution not found',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('logs the error thrown', () => {
|
||||||
|
expect(logger.error).toBeCalledWith(
|
||||||
|
'ContributionMessage was not sent successfully: Error: Contribution not found',
|
||||||
|
new Error('Contribution not found'),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it('throws error when contribution.userId equals user.id', async () => {
|
it('throws error when contribution.userId equals user.id', async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
await mutate({
|
await mutate({
|
||||||
mutation: login,
|
mutation: login,
|
||||||
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||||
@ -132,12 +141,19 @@ describe('ContributionMessageResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [
|
errors: [
|
||||||
new GraphQLError(
|
new GraphQLError(
|
||||||
'ContributionMessage was not successful: Error: Admin can not answer on own contribution',
|
'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: Error: Admin can not answer on his own contribution',
|
||||||
|
new Error('Admin can not answer on his own contribution'),
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('valid input', () => {
|
describe('valid input', () => {
|
||||||
@ -210,6 +226,7 @@ describe('ContributionMessageResolver', () => {
|
|||||||
|
|
||||||
describe('input not valid', () => {
|
describe('input not valid', () => {
|
||||||
it('throws error when contribution does not exist', async () => {
|
it('throws error when contribution does not exist', async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
await expect(
|
await expect(
|
||||||
mutate({
|
mutate({
|
||||||
mutation: createContributionMessage,
|
mutation: createContributionMessage,
|
||||||
@ -222,14 +239,22 @@ describe('ContributionMessageResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [
|
errors: [
|
||||||
new GraphQLError(
|
new GraphQLError(
|
||||||
'ContributionMessage was not successful: Error: Contribution not found',
|
'ContributionMessage was not sent successfully: Error: Contribution not found',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('logs the error thrown', () => {
|
||||||
|
expect(logger.error).toBeCalledWith(
|
||||||
|
'ContributionMessage was not sent successfully: Error: Contribution not found',
|
||||||
|
new Error('Contribution not found'),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it('throws error when other user tries to send createContributionMessage', async () => {
|
it('throws error when other user tries to send createContributionMessage', async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
await mutate({
|
await mutate({
|
||||||
mutation: login,
|
mutation: login,
|
||||||
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||||
@ -246,12 +271,19 @@ describe('ContributionMessageResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [
|
errors: [
|
||||||
new GraphQLError(
|
new GraphQLError(
|
||||||
'ContributionMessage was not successful: Error: Can not send message to contribution of another user',
|
'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: Error: Can not send message to contribution of another user',
|
||||||
|
new Error('Can not send message to contribution of another user'),
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('valid input', () => {
|
describe('valid input', () => {
|
||||||
|
|||||||
@ -12,10 +12,10 @@ import { ContributionStatus } from '@enum/ContributionStatus'
|
|||||||
import { Order } from '@enum/Order'
|
import { Order } from '@enum/Order'
|
||||||
import Paginated from '@arg/Paginated'
|
import Paginated from '@arg/Paginated'
|
||||||
|
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { Context, getUser } from '@/server/context'
|
import { Context, getUser } from '@/server/context'
|
||||||
import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants'
|
import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants'
|
||||||
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
@Resolver()
|
@Resolver()
|
||||||
export class ContributionMessageResolver {
|
export class ContributionMessageResolver {
|
||||||
@ -54,8 +54,7 @@ export class ContributionMessageResolver {
|
|||||||
await queryRunner.commitTransaction()
|
await queryRunner.commitTransaction()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await queryRunner.rollbackTransaction()
|
await queryRunner.rollbackTransaction()
|
||||||
logger.error(`ContributionMessage was not successful: ${e}`)
|
throw new LogError(`ContributionMessage was not sent successfully: ${e}`, e)
|
||||||
throw new Error(`ContributionMessage was not successful: ${e}`)
|
|
||||||
} finally {
|
} finally {
|
||||||
await queryRunner.release()
|
await queryRunner.release()
|
||||||
}
|
}
|
||||||
@ -95,9 +94,7 @@ export class ContributionMessageResolver {
|
|||||||
@Ctx() context: Context,
|
@Ctx() context: Context,
|
||||||
): Promise<ContributionMessage> {
|
): Promise<ContributionMessage> {
|
||||||
const user = getUser(context)
|
const user = getUser(context)
|
||||||
if (!user.emailContact) {
|
|
||||||
user.emailContact = await UserContact.findOneOrFail({ where: { id: user.emailId } })
|
|
||||||
}
|
|
||||||
const queryRunner = getConnection().createQueryRunner()
|
const queryRunner = getConnection().createQueryRunner()
|
||||||
await queryRunner.connect()
|
await queryRunner.connect()
|
||||||
await queryRunner.startTransaction('REPEATABLE READ')
|
await queryRunner.startTransaction('REPEATABLE READ')
|
||||||
@ -108,12 +105,10 @@ export class ContributionMessageResolver {
|
|||||||
relations: ['user'],
|
relations: ['user'],
|
||||||
})
|
})
|
||||||
if (!contribution) {
|
if (!contribution) {
|
||||||
logger.error('Contribution not found')
|
throw new LogError('Contribution not found', contributionId)
|
||||||
throw new Error('Contribution not found')
|
|
||||||
}
|
}
|
||||||
if (contribution.userId === user.id) {
|
if (contribution.userId === user.id) {
|
||||||
logger.error('Admin can not answer on own contribution')
|
throw new LogError('Admin can not answer on his own contribution', contributionId)
|
||||||
throw new Error('Admin can not answer on own contribution')
|
|
||||||
}
|
}
|
||||||
if (!contribution.user.emailContact) {
|
if (!contribution.user.emailContact) {
|
||||||
contribution.user.emailContact = await UserContact.findOneOrFail({
|
contribution.user.emailContact = await UserContact.findOneOrFail({
|
||||||
@ -149,8 +144,7 @@ export class ContributionMessageResolver {
|
|||||||
await queryRunner.commitTransaction()
|
await queryRunner.commitTransaction()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await queryRunner.rollbackTransaction()
|
await queryRunner.rollbackTransaction()
|
||||||
logger.error(`ContributionMessage was not successful: ${e}`)
|
throw new LogError(`ContributionMessage was not sent successfully: ${e}`, e)
|
||||||
throw new Error(`ContributionMessage was not successful: ${e}`)
|
|
||||||
} finally {
|
} finally {
|
||||||
await queryRunner.release()
|
await queryRunner.release()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,11 +22,7 @@ import {
|
|||||||
listContributions,
|
listContributions,
|
||||||
listUnconfirmedContributions,
|
listUnconfirmedContributions,
|
||||||
} from '@/seeds/graphql/queries'
|
} from '@/seeds/graphql/queries'
|
||||||
import {
|
import { sendContributionConfirmedEmail } from '@/emails/sendEmailVariants'
|
||||||
// sendAccountActivationEmail,
|
|
||||||
sendContributionConfirmedEmail,
|
|
||||||
// sendContributionRejectedEmail,
|
|
||||||
} from '@/emails/sendEmailVariants'
|
|
||||||
import {
|
import {
|
||||||
cleanDB,
|
cleanDB,
|
||||||
resetToken,
|
resetToken,
|
||||||
@ -47,7 +43,6 @@ import { EventProtocolType } from '@/event/EventProtocolType'
|
|||||||
import { logger, i18n as localization } from '@test/testSetup'
|
import { logger, i18n as localization } from '@test/testSetup'
|
||||||
import { UserInputError } from 'apollo-server-express'
|
import { UserInputError } from 'apollo-server-express'
|
||||||
|
|
||||||
// mock account activation email to avoid console spam
|
|
||||||
// mock account activation email to avoid console spam
|
// mock account activation email to avoid console spam
|
||||||
jest.mock('@/emails/sendEmailVariants', () => {
|
jest.mock('@/emails/sendEmailVariants', () => {
|
||||||
const originalModule = jest.requireActual('@/emails/sendEmailVariants')
|
const originalModule = jest.requireActual('@/emails/sendEmailVariants')
|
||||||
|
|||||||
@ -44,12 +44,14 @@ import {
|
|||||||
EventContributionConfirm,
|
EventContributionConfirm,
|
||||||
EventAdminContributionCreate,
|
EventAdminContributionCreate,
|
||||||
EventAdminContributionDelete,
|
EventAdminContributionDelete,
|
||||||
|
EventAdminContributionDeny,
|
||||||
EventAdminContributionUpdate,
|
EventAdminContributionUpdate,
|
||||||
} from '@/event/Event'
|
} from '@/event/Event'
|
||||||
import { writeEvent } from '@/event/EventProtocolEmitter'
|
import { writeEvent } from '@/event/EventProtocolEmitter'
|
||||||
import { calculateDecay } from '@/util/decay'
|
import { calculateDecay } from '@/util/decay'
|
||||||
import {
|
import {
|
||||||
sendContributionConfirmedEmail,
|
sendContributionConfirmedEmail,
|
||||||
|
sendContributionDeletedEmail,
|
||||||
sendContributionDeniedEmail,
|
sendContributionDeniedEmail,
|
||||||
} from '@/emails/sendEmailVariants'
|
} from '@/emails/sendEmailVariants'
|
||||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||||
@ -548,7 +550,7 @@ export class ContributionResolver {
|
|||||||
eventAdminContributionDelete.amount = contribution.amount
|
eventAdminContributionDelete.amount = contribution.amount
|
||||||
eventAdminContributionDelete.contributionId = contribution.id
|
eventAdminContributionDelete.contributionId = contribution.id
|
||||||
await writeEvent(event.setEventAdminContributionDelete(eventAdminContributionDelete))
|
await writeEvent(event.setEventAdminContributionDelete(eventAdminContributionDelete))
|
||||||
sendContributionDeniedEmail({
|
sendContributionDeletedEmail({
|
||||||
firstName: user.firstName,
|
firstName: user.firstName,
|
||||||
lastName: user.lastName,
|
lastName: user.lastName,
|
||||||
email: user.emailContact.email,
|
email: user.emailContact.email,
|
||||||
@ -764,6 +766,13 @@ export class ContributionResolver {
|
|||||||
contributionToUpdate.deniedAt = new Date()
|
contributionToUpdate.deniedAt = new Date()
|
||||||
const res = await contributionToUpdate.save()
|
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({
|
sendContributionDeniedEmail({
|
||||||
firstName: user.firstName,
|
firstName: user.firstName,
|
||||||
lastName: user.lastName,
|
lastName: user.lastName,
|
||||||
|
|||||||
@ -23,8 +23,13 @@
|
|||||||
"commonGoodContributionConfirmed": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde soeben von {senderFirstName} {senderLastName} bestätigt und in deinem Gradido-Konto gutgeschrieben.",
|
"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"
|
"subject": "Gradido: Dein Gemeinwohl-Beitrag wurde bestätigt"
|
||||||
},
|
},
|
||||||
"contributionRejected": {
|
"contributionDeleted": {
|
||||||
"commonGoodContributionRejected": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde von {senderFirstName} {senderLastName} abgelehnt.",
|
"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",
|
"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“!"
|
"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“!"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -23,6 +23,11 @@
|
|||||||
"commonGoodContributionConfirmed": "Your public good contribution “{contributionMemo}” has just been confirmed by {senderFirstName} {senderLastName} and credited to your Gradido account.",
|
"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"
|
"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": {
|
"contributionDenied": {
|
||||||
"commonGoodContributionDenied": "Your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.",
|
"commonGoodContributionDenied": "Your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.",
|
||||||
"subject": "Gradido: Your common good contribution was rejected",
|
"subject": "Gradido: Your common good contribution was rejected",
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
CONFIG_VERSION=v1.2022-03-18
|
|
||||||
|
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_USER=root
|
DB_USER=root
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
CONFIG_VERSION=v1.2023-01-01
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
CONFIG_VERSION=v4.2022-12-20
|
|
||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
DEFAULT_PUBLISHER_ID=2896
|
DEFAULT_PUBLISHER_ID=2896
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user