diff options
Diffstat (limited to 'server/lib/notifier.ts')
-rw-r--r-- | server/lib/notifier.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts index 5c50fcf01..9c2f16c27 100644 --- a/server/lib/notifier.ts +++ b/server/lib/notifier.ts | |||
@@ -24,6 +24,7 @@ import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../type | |||
24 | import { isBlockedByServerOrAccount } from './blocklist' | 24 | import { isBlockedByServerOrAccount } from './blocklist' |
25 | import { Emailer } from './emailer' | 25 | import { Emailer } from './emailer' |
26 | import { PeerTubeSocket } from './peertube-socket' | 26 | import { PeerTubeSocket } from './peertube-socket' |
27 | import { AccountModel } from '@server/models/account/account' | ||
27 | 28 | ||
28 | class Notifier { | 29 | class Notifier { |
29 | 30 | ||
@@ -137,7 +138,7 @@ class Notifier { | |||
137 | }) | 138 | }) |
138 | } | 139 | } |
139 | 140 | ||
140 | notifyOnAbuseMessage (abuse: MAbuseFull, message: AbuseMessageModel): void { | 141 | notifyOnAbuseMessage (abuse: MAbuseFull, message: MAbuseMessage): void { |
141 | this.notifyOfNewAbuseMessage(abuse, message) | 142 | this.notifyOfNewAbuseMessage(abuse, message) |
142 | .catch(err => { | 143 | .catch(err => { |
143 | logger.error('Cannot notify on new abuse %d message.', abuse.id, { err }) | 144 | logger.error('Cannot notify on new abuse %d message.', abuse.id, { err }) |
@@ -436,6 +437,8 @@ class Notifier { | |||
436 | const url = this.getAbuseUrl(abuse) | 437 | const url = this.getAbuseUrl(abuse) |
437 | logger.info('Notifying reporter and moderators of new abuse message on %s.', url) | 438 | logger.info('Notifying reporter and moderators of new abuse message on %s.', url) |
438 | 439 | ||
440 | const accountMessage = await AccountModel.load(message.accountId) | ||
441 | |||
439 | function settingGetter (user: MUserWithNotificationSetting) { | 442 | function settingGetter (user: MUserWithNotificationSetting) { |
440 | return user.NotificationSetting.abuseNewMessage | 443 | return user.NotificationSetting.abuseNewMessage |
441 | } | 444 | } |
@@ -452,11 +455,11 @@ class Notifier { | |||
452 | } | 455 | } |
453 | 456 | ||
454 | function emailSenderReporter (emails: string[]) { | 457 | function emailSenderReporter (emails: string[]) { |
455 | return Emailer.Instance.addAbuseNewMessageNotification(emails, { target: 'reporter', abuse, message }) | 458 | return Emailer.Instance.addAbuseNewMessageNotification(emails, { target: 'reporter', abuse, message, accountMessage }) |
456 | } | 459 | } |
457 | 460 | ||
458 | function emailSenderModerators (emails: string[]) { | 461 | function emailSenderModerators (emails: string[]) { |
459 | return Emailer.Instance.addAbuseNewMessageNotification(emails, { target: 'moderator', abuse, message }) | 462 | return Emailer.Instance.addAbuseNewMessageNotification(emails, { target: 'moderator', abuse, message, accountMessage }) |
460 | } | 463 | } |
461 | 464 | ||
462 | async function buildReporterOptions () { | 465 | async function buildReporterOptions () { |