fix(backend): Send Abuse Reports To Set Maintainer E-Mail
This commit is contained in:
parent
c35da729fc
commit
789deeabac
2 changed files with 93 additions and 9 deletions
|
|
@ -82,6 +82,25 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects all email addresses that a abuse report should be sent to.
|
||||
*/
|
||||
@bindThis
|
||||
public async getRecipientEMailAddresses(): Promise<string[]> {
|
||||
const recipientEMailAddresses = await this.fetchEMailRecipients().then(it => it
|
||||
.filter(it => it.isActive && it.userProfile?.emailVerified)
|
||||
.map(it => it.userProfile?.email)
|
||||
.filter(x => x != null),
|
||||
);
|
||||
|
||||
recipientEMailAddresses.push(
|
||||
...(this.meta.email ? [this.meta.email] : []),
|
||||
...(this.meta.maintainerEmail ? [this.meta.maintainerEmail] : []),
|
||||
);
|
||||
|
||||
return recipientEMailAddresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mailを用いて{@link abuseReports}の内容を管理者各位に通知する.
|
||||
* メールアドレスの送信先は以下の通り.
|
||||
|
|
@ -96,15 +115,7 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
|
|||
return;
|
||||
}
|
||||
|
||||
const recipientEMailAddresses = await this.fetchEMailRecipients().then(it => it
|
||||
.filter(it => it.isActive && it.userProfile?.emailVerified)
|
||||
.map(it => it.userProfile?.email)
|
||||
.filter(x => x != null),
|
||||
);
|
||||
|
||||
recipientEMailAddresses.push(
|
||||
...(this.meta.email ? [this.meta.email] : []),
|
||||
);
|
||||
const recipientEMailAddresses = await this.getRecipientEMailAddresses();
|
||||
|
||||
if (recipientEMailAddresses.length <= 0) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue