Refactor 'sendContributionRejectedEmail' email to HTML and translatable

This commit is contained in:
Wolfgang Huß 2022-11-24 16:10:29 +01:00
parent dd33254acb
commit 72213988ac
6 changed files with 58 additions and 7 deletions

View File

@ -0,0 +1,17 @@
doctype html
html(lang=locale)
head
title= t('emails.contributionRejected.subject')
body
h1(style='margin-bottom: 24px;')= t('emails.contributionRejected.subject')
#container.col
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
p= t('emails.contributionRejected.commonGoodContributionRejected', { senderFirstName, senderLastName, contributionMemo })
p= t('emails.contributionRejected.toSeeContributionsAndMessages')
p= t('emails.general.linkToYourAccount')
span= " "
a(href=overviewURL) #{overviewURL}
p= t('emails.general.pleaseDoNotReply')
p(style='margin-top: 24px;')= t('emails.general.sincerelyYours')
br
span= t('emails.general.yourGradidoTeam')

View File

@ -0,0 +1 @@
= t('emails.contributionRejected.subject')

View File

@ -100,3 +100,27 @@ export const sendContributionConfirmedEmail = (data: {
},
})
}
export const sendContributionRejectedEmail = (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: 'contributionRejected',
locals: {
firstName: data.firstName,
lastName: data.lastName,
locale: data.language,
senderFirstName: data.senderFirstName,
senderLastName: data.senderLastName,
contributionMemo: data.contributionMemo,
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
},
})
}

View File

@ -44,6 +44,7 @@ import {
sendAddedContributionMessageEmail,
sendAccountActivationEmail,
sendContributionConfirmedEmail,
sendContributionRejectedEmail,
} from '@/emails/sendEmailVariants'
import { transactionLinkCode as contributionLinkCode } from './TransactionLinkResolver'
import CONFIG from '@/config'
@ -67,7 +68,6 @@ import { ContributionMessage as DbContributionMessage } from '@entity/Contributi
import ContributionMessageArgs from '@arg/ContributionMessageArgs'
import { ContributionMessageType } from '@enum/MessageType'
import { ContributionMessage } from '@model/ContributionMessage'
import { sendContributionRejectedEmail } from '@/mailer/sendContributionRejectedEmail'
import { eventProtocol } from '@/event/EventProtocolEmitter'
import {
Event,
@ -489,14 +489,13 @@ export class AdminResolver {
event.setEventAdminContributionDelete(eventAdminContributionDelete),
)
sendContributionRejectedEmail({
firstName: user.firstName,
lastName: user.lastName,
email: user.emailContact.email,
language: user.language,
senderFirstName: moderator.firstName,
senderLastName: moderator.lastName,
recipientEmail: user.emailContact.email,
recipientFirstName: user.firstName,
recipientLastName: user.lastName,
contributionMemo: contribution.memo,
contributionAmount: contribution.amount,
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
})
return !!res

View File

@ -25,6 +25,11 @@
"contributionAmount": "Betrag: {contributionAmount} GDD",
"subject": "Gradido: Dein Gemeinwohl-Beitrag wurde bestätigt"
},
"contributionRejected": {
"commonGoodContributionRejected": "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“!"
},
"general": {
"decimalSeparator": ",",
"helloName": "Hallo {firstName} {lastName},",

View File

@ -3,7 +3,7 @@
"addedContributionMessage": {
"commonGoodContributionMessage": "you have received a message from {senderFirstName} {senderLastName} regarding your common good contribution “{contributionMemo}”.",
"subject": "Gradido: Message about your common good contribution",
"toSeeAndAnswerMessage": "To view and reply to the message, go to the “Community” menu in your Gradido account and click on the “My Contributions to the Common Good” tab!"
"toSeeAndAnswerMessage": "To view and reply to the message, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!"
},
"accountActivation": {
"duration": "The link has a validity of {hours} hours and {minutes} minutes. If the validity of the link has already expired, you can have a new link sent to you here by entering your email address:",
@ -25,6 +25,11 @@
"contributionAmount": "Amount: {contributionAmount} GDD",
"subject": "Gradido: Your common good contribution was confirmed"
},
"contributionRejected": {
"commonGoodContributionRejected": "your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.",
"subject": "Gradido: Your common good contribution was rejected",
"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!"
},
"general": {
"decimalSeparator": ".",
"helloName": "Hello {firstName} {lastName}",