diff options
| author | dakkar <dakkar@thenautilus.net> | 2025-06-19 15:54:55 +0000 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2025-06-19 15:54:55 +0000 |
| commit | 169c06d4cafbec527d99b1ceffd9ecd5d1fe5a94 (patch) | |
| tree | 74c2587f78dd4c4c8398765638615f12ce55711a /packages/backend/src | |
| parent | merge: update package list for docker (!1130) (diff) | |
| parent | refactor(backend): Remove Useless Variable (diff) | |
| download | sharkey-169c06d4cafbec527d99b1ceffd9ecd5d1fe5a94.tar.gz sharkey-169c06d4cafbec527d99b1ceffd9ecd5d1fe5a94.tar.bz2 sharkey-169c06d4cafbec527d99b1ceffd9ecd5d1fe5a94.zip | |
merge: fix(backend): Send Abuse Reports To Set Maintainer E-Mail (!1127)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1127
Closes #1069
Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
Diffstat (limited to 'packages/backend/src')
| -rw-r--r-- | packages/backend/src/core/AbuseReportNotificationService.ts | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/packages/backend/src/core/AbuseReportNotificationService.ts b/packages/backend/src/core/AbuseReportNotificationService.ts index 9bca795479..307f22586e 100644 --- a/packages/backend/src/core/AbuseReportNotificationService.ts +++ b/packages/backend/src/core/AbuseReportNotificationService.ts @@ -83,6 +83,28 @@ 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), + ); + + if (this.meta.email) { + recipientEMailAddresses.push(this.meta.email); + } + + if (this.meta.maintainerEmail) { + recipientEMailAddresses.push(this.meta.maintainerEmail); + } + + return recipientEMailAddresses; + } + + /** * Mailを用いて{@link abuseReports}の内容を管理者各位に通知する. * メールアドレスの送信先は以下の通り. * - モデレータ権限所有者ユーザ(設定画面からメールアドレスの設定を行っているユーザに限る) @@ -96,15 +118,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; |