1 import { logger } from '@server/helpers/logger'
2 import { getAbuseTargetUrl } from '@server/lib/activitypub/url'
3 import { UserModel } from '@server/models/user/user'
4 import { MUserDefault } from '@server/types/models'
5 import { AbstractNewAbuseMessage } from './abstract-new-abuse-message'
7 export class NewAbuseMessageForReporter extends AbstractNewAbuseMessage {
8 private reporter: MUserDefault
11 // Only notify our users
12 if (this.abuse.ReporterAccount.isOwned() !== true) return
14 await this.loadMessageAccount()
16 const reporter = await UserModel.loadByAccountActorId(this.abuse.ReporterAccount.actorId)
17 // Don't notify my own message
18 if (reporter.Account.id === this.message.accountId) return
20 this.reporter = reporter
24 logger.info('Notifying reporter of new abuse message on %s.', getAbuseTargetUrl(this.abuse))
28 if (!this.reporter) return []
30 return [ this.reporter ]
33 createEmail (to: string) {
34 return this.createEmailFor(to, 'reporter')