Commit 17e1eb2e authored by Fabien Forestier's avatar Fabien Forestier
Browse files

Merge branch 'development' into 'master'

Version 1.2.3

See merge request refonte-data/service-email!5
parents 56572e3f 1a4ddb18
Pipeline #2441 passed with stage
in 8 seconds
{
"name": "service-email",
"version": "1.2.2",
"version": "1.2.3",
"description": "description",
"author": "",
"license": "MIT",
......
This diff is collapsed.
......@@ -48,10 +48,26 @@
<mj-text>
Un nouveau feedback a été déposée le ${options.datetime}.
</mj-text>
<mj-text>
Voici un résumé de la demande :
</mj-text>
<mj-text font-weight="bold">
Email de l\'utilisateur:
</mj-text>
<mj-text font-style="italic">
${options.email}
</mj-text>
<mj-text font-weight="bold">
Avis de l\'utilisateur:
</mj-text>
<mj-text font-style="italic">
${options.feeling}
</mj-text>
<mj-text font-weight="bold">
Url:
</mj-text>
......
This diff is collapsed.
......@@ -69,7 +69,19 @@ export class EmailService {
userAgentString += `Source: ${userAgentParsed.source}`;
}
const feelings = [
'Pas d\'avis',
'Bof...',
'Pas mal',
'Top!'
]
const feeling = feedbackForm.feeling ? feelings[feedbackForm.feeling] : '-';
const email = feedbackForm.email ? feedbackForm.email : '-';
const feedbackEmailBody = buildFeedbackEmail({
feeling,
email,
url: feedbackForm.url,
userAgent: userAgentString,
version: feedbackForm.version,
......@@ -77,6 +89,7 @@ export class EmailService {
datetime: moment().format('DD/MM/YYYY à HH:mm'),
imageHost: this.config.imageHost,
});
const feedbackEmail = new EmailWithoutFrom();
feedbackEmail.to = [this.config.userSupportMailbox];
......@@ -84,6 +97,10 @@ export class EmailService {
feedbackEmail.to = feedbackEmail.to.concat(this.config.additionalFeedbackEmails.split(','));
}
if (feedbackForm.email) {
feedbackEmail.replyTo = feedbackForm.email;
}
feedbackEmail.subject = 'Feedback';
feedbackEmail.html = feedbackEmailBody;
......
import { IsDefined, Length, IsEmail } from 'class-validator';
import { IsDefined, Length, IsEmail, IsString, IsNumber } from 'class-validator';
import { ApiModelProperty, ApiModelPropertyOptional } from '@nestjs/swagger';
export class ContactForm {
......@@ -93,4 +93,10 @@ export class FeedbackForm {
@ApiModelProperty()
@IsDefined()
message: string;
@ApiModelPropertyOptional()
email?: string;
@ApiModelPropertyOptional()
feeling?: number;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment