1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

task: Added name and email of requester to track down spammers (#10235)

As the title says. This adds name and email of requester to CR approval
mails. This will hopefully have users complain to their coworkers rather
than Unleash if they get too many mails.
This commit is contained in:
Christopher Kolstad 2025-06-30 11:54:55 +02:00 committed by GitHub
parent e2bb894f68
commit 873d64e84b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 9 deletions

View File

@ -45,6 +45,13 @@ export interface IEmailEnvelope {
headers?: Record<string, string>;
}
export interface ICrApprovalParameters {
changeRequestLink: string;
changeRequestTitle: string;
requesterName: string;
requesterEmail: string;
}
const RESET_MAIL_SUBJECT = 'Unleash - Reset your password';
const GETTING_STARTED_SUBJECT = 'Welcome to Unleash';
const PRODUCTIVITY_REPORT = 'Unleash - productivity report';
@ -124,8 +131,7 @@ export class EmailService {
async sendRequestedCRApprovalEmail(
recipient: string,
changeRequestLink: string,
changeRequestTitle: string,
crApprovalParams: ICrApprovalParameters,
): Promise<IEmailEnvelope> {
if (this.configured()) {
const year = new Date().getFullYear();
@ -133,8 +139,7 @@ export class EmailService {
'requested-cr-approval',
TemplateFormat.HTML,
{
changeRequestLink,
changeRequestTitle,
...crApprovalParams,
year,
},
);
@ -142,8 +147,7 @@ export class EmailService {
'requested-cr-approval',
TemplateFormat.PLAIN,
{
changeRequestLink,
changeRequestTitle,
...crApprovalParams,
year,
},
);
@ -173,7 +177,6 @@ export class EmailService {
this.logger.warn(
'No mailer is configured. Please read the docs on how to configure an email service',
);
this.logger.debug('Change request link: ', changeRequestLink);
res({
from: this.sender,
to: recipient,

View File

@ -340,7 +340,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateBody">
<tr>
<td valign="top" class="bodyContent" mc:edit="body_content">
<h1>You have been added to review {{{ changeRequestTitle }}}</h1>
<h1>You have been added to review {{{ changeRequestTitle }}} by {{{ requesterName }}} ({{{ requesterEmail }}}) </h1>
<p>Click <a class="changeRequestLink" href="{{{ changeRequestLink }}}" target="_blank" rel="noopener noreferrer">{{{changeRequestLink}}}</a> to review it</p>
</td>
</tr>

View File

@ -1,3 +1,3 @@
You have been added to review {{{ changeRequestTitle }}}
You have been added to review {{{ changeRequestTitle }}} by {{{ requesterName }}} ({{{ requesterEmail }}})
Follow the link: {{{ changeRequestLink }}} to review it.