mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Refactor 'sendAddedContributionMessageEmail' email to HTML and translatable
This commit is contained in:
parent
53b29db25e
commit
76fa425529
20
backend/src/emails/accountActivation/html.pug
Normal file
20
backend/src/emails/accountActivation/html.pug
Normal file
@ -0,0 +1,20 @@
|
||||
doctype html
|
||||
html(lang=locale)
|
||||
head
|
||||
title= t('emails.accountActivation.subject')
|
||||
body
|
||||
h1(style='margin-bottom: 24px;')= t('emails.accountActivation.subject')
|
||||
#container.col
|
||||
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
|
||||
p= t('emails.accountActivation.emailRegistered')
|
||||
p= t('emails.accountActivation.pleaseClickLink')
|
||||
br
|
||||
a(href=activationLink) #{activationLink}
|
||||
br
|
||||
span= t('emails.accountActivation.orCopyLink')
|
||||
p= t('emails.accountActivation.duration', { hours: timeDurationObject.hours, minutes: timeDurationObject.minutes })
|
||||
br
|
||||
a(href=resendLink) #{resendLink}
|
||||
p(style='margin-top: 24px;')= t('emails.general.sincerelyYours')
|
||||
br
|
||||
span= t('emails.general.yourGradidoTeam')
|
||||
1
backend/src/emails/accountActivation/subject.pug
Normal file
1
backend/src/emails/accountActivation/subject.pug
Normal file
@ -0,0 +1 @@
|
||||
= t('emails.accountActivation.subject')
|
||||
17
backend/src/emails/addedContributionMessage/html.pug
Normal file
17
backend/src/emails/addedContributionMessage/html.pug
Normal file
@ -0,0 +1,17 @@
|
||||
doctype html
|
||||
html(lang=locale)
|
||||
head
|
||||
title= t('emails.addedContributionMessage.subject')
|
||||
body
|
||||
h1(style='margin-bottom: 24px;')= t('emails.addedContributionMessage.subject')
|
||||
#container.col
|
||||
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
|
||||
p= t('emails.addedContributionMessage.commonGoodContributionMessage', { senderFirstName, senderLastName, contributionMemo })
|
||||
p= t('emails.addedContributionMessage.toSeeAndAnswerMessage')
|
||||
p= t('emails.addedContributionMessage.linkToYourAccount')
|
||||
span= " "
|
||||
a(href=overviewURL) #{overviewURL}
|
||||
p= t('emails.addedContributionMessage.pleaseDoNotReply')
|
||||
p(style='margin-top: 24px;')= t('emails.general.sincerelyYours')
|
||||
br
|
||||
span= t('emails.general.yourGradidoTeam')
|
||||
1
backend/src/emails/addedContributionMessage/subject.pug
Normal file
1
backend/src/emails/addedContributionMessage/subject.pug
Normal file
@ -0,0 +1 @@
|
||||
= t('emails.addedContributionMessage.subject')
|
||||
@ -1,20 +0,0 @@
|
||||
doctype html
|
||||
html(lang=locale)
|
||||
head
|
||||
title= t('emails.sendAccountActivation.subject')
|
||||
body
|
||||
h1(style='margin-bottom: 24px;')= t('emails.sendAccountActivation.subject')
|
||||
#container.col
|
||||
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
|
||||
p= t('emails.sendAccountActivation.emailRegistered')
|
||||
p= t('emails.sendAccountActivation.pleaseClickLink')
|
||||
br
|
||||
a(href=activationLink) #{activationLink}
|
||||
br
|
||||
span= t('emails.sendAccountActivation.orCopyLink')
|
||||
p= t('emails.sendAccountActivation.duration', { hours: timeDurationObject.hours, minutes: timeDurationObject.minutes })
|
||||
br
|
||||
a(href=resendLink) #{resendLink}
|
||||
p(style='margin-top: 24px;')= t('emails.general.sincerelyYours')
|
||||
br
|
||||
span= t('emails.general.yourGradidoTeam')
|
||||
@ -1 +0,0 @@
|
||||
= t('emails.sendAccountActivation.subject')
|
||||
@ -38,7 +38,7 @@ describe('sendEmailVariants', () => {
|
||||
receiver: {
|
||||
to: 'Peter Lustig <peter@lustig.de>',
|
||||
},
|
||||
template: 'sendAccountActivation',
|
||||
template: 'accountActivation',
|
||||
locals: {
|
||||
firstName: 'Peter',
|
||||
lastName: 'Lustig',
|
||||
|
||||
@ -1,6 +1,32 @@
|
||||
import CONFIG from '@/config'
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
|
||||
export const sendAddedContributionMessageEmail = (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: 'addedContributionMessage',
|
||||
locals: {
|
||||
firstName: data.firstName,
|
||||
lastName: data.lastName,
|
||||
locale: data.language,
|
||||
senderFirstName: data.senderFirstName,
|
||||
senderLastName: data.senderLastName,
|
||||
contributionMemo: data.contributionMemo,
|
||||
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const sendAccountActivationEmail = (data: {
|
||||
firstName: string
|
||||
lastName: string
|
||||
@ -11,7 +37,7 @@ export const sendAccountActivationEmail = (data: {
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'sendAccountActivation',
|
||||
template: 'accountActivation',
|
||||
locals: {
|
||||
firstName: data.firstName,
|
||||
lastName: data.lastName,
|
||||
|
||||
@ -40,7 +40,10 @@ import Paginated from '@arg/Paginated'
|
||||
import TransactionLinkFilters from '@arg/TransactionLinkFilters'
|
||||
import { Order } from '@enum/Order'
|
||||
import { findUserByEmail, activationLink, getTimeDurationObject } from './UserResolver'
|
||||
import { sendAccountActivationEmail } from '@/emails/sendEmailVariants'
|
||||
import {
|
||||
sendAddedContributionMessageEmail,
|
||||
sendAccountActivationEmail,
|
||||
} from '@/emails/sendEmailVariants'
|
||||
import { transactionLinkCode as contributionLinkCode } from './TransactionLinkResolver'
|
||||
import CONFIG from '@/config'
|
||||
import {
|
||||
@ -65,7 +68,6 @@ import { ContributionMessageType } from '@enum/MessageType'
|
||||
import { ContributionMessage } from '@model/ContributionMessage'
|
||||
import { sendContributionConfirmedEmail } from '@/mailer/sendContributionConfirmedEmail'
|
||||
import { sendContributionRejectedEmail } from '@/mailer/sendContributionRejectedEmail'
|
||||
import { sendAddedContributionMessageEmail } from '@/mailer/sendAddedContributionMessageEmail'
|
||||
import { eventProtocol } from '@/event/EventProtocolEmitter'
|
||||
import {
|
||||
Event,
|
||||
@ -896,15 +898,13 @@ export class AdminResolver {
|
||||
}
|
||||
|
||||
await sendAddedContributionMessageEmail({
|
||||
firstName: contribution.user.firstName,
|
||||
lastName: contribution.user.lastName,
|
||||
email: contribution.user.emailContact.email,
|
||||
language: contribution.user.language,
|
||||
senderFirstName: user.firstName,
|
||||
senderLastName: user.lastName,
|
||||
recipientFirstName: contribution.user.firstName,
|
||||
recipientLastName: contribution.user.lastName,
|
||||
recipientEmail: contribution.user.emailContact.email,
|
||||
senderEmail: user.emailContact.email,
|
||||
contributionMemo: contribution.memo,
|
||||
message,
|
||||
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
|
||||
})
|
||||
await queryRunner.commitTransaction()
|
||||
} catch (e) {
|
||||
|
||||
@ -1,5 +1,19 @@
|
||||
{
|
||||
"emails": {
|
||||
"addedContributionMessage": {
|
||||
"commonGoodContributionMessage": "du hast zu deinem Gemeinwohl-Beitrag „{contributionMemo}“ eine Nachricht von {senderFirstName} {senderLastName} erhalten.",
|
||||
"linkToYourAccount": "Link zu deinem Konto:",
|
||||
"pleaseDoNotReply": "Bitte antworte nicht auf diese E-Mail!",
|
||||
"subject": "Gradido: Nachricht zu deinem Gemeinwohl-Beitrag",
|
||||
"toSeeAndAnswerMessage": "Um die Nachricht zu sehen und darauf zu antworten, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!"
|
||||
},
|
||||
"accountActivation": {
|
||||
"duration": "Der Link hat eine Gültigkeit von {hours} Stunden und {minutes} Minuten. Sollte die Gültigkeit des Links bereits abgelaufen sein, kannst du dir hier einen neuen Link schicken lassen, in dem du deine E-Mail-Adresse eingibst:",
|
||||
"emailRegistered": "deine E-Mail-Adresse wurde soeben bei Gradido registriert.",
|
||||
"pleaseClickLink": "Klicke bitte auf diesen Link, um die Registrierung abzuschließen und dein Gradido-Konto zu aktivieren:",
|
||||
"orCopyLink": "oder kopiere den obigen Link in dein Browserfenster.",
|
||||
"subject": "Gradido: E-Mail Überprüfung"
|
||||
},
|
||||
"accountMultiRegistration": {
|
||||
"emailExists": "Es existiert jedoch zu deiner E-Mail-Adresse schon ein Konto.",
|
||||
"emailReused": "deine E-Mail-Adresse wurde soeben erneut benutzt, um bei Gradido ein Konto zu registrieren.",
|
||||
@ -10,15 +24,8 @@
|
||||
},
|
||||
"general": {
|
||||
"helloName": "Hallo {firstName} {lastName},",
|
||||
"sincerelyYours": "Mit freundlichen Grüßen,",
|
||||
"sincerelyYours": "Liebe Grüße",
|
||||
"yourGradidoTeam": "dein Gradido-Team"
|
||||
},
|
||||
"sendAccountActivation": {
|
||||
"duration": "Der Link hat eine Gültigkeit von {hours} Stunden und {minutes} Minuten. Sollte die Gültigkeit des Links bereits abgelaufen sein, kannst du dir hier einen neuen Link schicken lassen, in dem du deine E-Mail-Adresse eingibst:",
|
||||
"emailRegistered": "deine E-Mail-Adresse wurde soeben bei Gradido registriert.",
|
||||
"pleaseClickLink": "Klicke bitte auf diesen Link, um die Registrierung abzuschließen und dein Gradido-Konto zu aktivieren:",
|
||||
"orCopyLink": "oder kopiere den obigen Link in dein Browserfenster.",
|
||||
"subject": "Gradido: E-Mail Überprüfung"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,19 @@
|
||||
{
|
||||
"emails": {
|
||||
"addedContributionMessage": {
|
||||
"commonGoodContributionMessage": "you have received a message from {senderFirstName} {senderLastName} regarding your common good contribution “{contributionMemo}”.",
|
||||
"linkToYourAccount": "Link to your account:",
|
||||
"pleaseDoNotReply": "Please do not reply to this email!",
|
||||
"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!"
|
||||
},
|
||||
"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:",
|
||||
"emailRegistered": "Your email address has just been registered with Gradido.",
|
||||
"pleaseClickLink": "Please click on this link to complete the registration and activate your Gradido account:",
|
||||
"orCopyLink": "or copy the link above into your browser window.",
|
||||
"subject": "Gradido: Email Verification"
|
||||
},
|
||||
"accountMultiRegistration": {
|
||||
"emailExists": "However, an account already exists for your email address.",
|
||||
"emailReused": "Your email address has just been used again to register an account with Gradido.",
|
||||
@ -10,15 +24,8 @@
|
||||
},
|
||||
"general": {
|
||||
"helloName": "Hello {firstName} {lastName}",
|
||||
"sincerelyYours": "Sincerely yours,",
|
||||
"sincerelyYours": "Kind regards,",
|
||||
"yourGradidoTeam": "your Gradido team"
|
||||
},
|
||||
"sendAccountActivation": {
|
||||
"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:",
|
||||
"emailRegistered": "Your email address has just been registered with Gradido.",
|
||||
"pleaseClickLink": "Please click on this link to complete the registration and activate your Gradido account:",
|
||||
"orCopyLink": "or copy the link above into your browser window.",
|
||||
"subject": "Gradido: Email Verification"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user