mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 03:43:07 +02:00
parent
cb9bd6a004
commit
fa5cf36602
1 changed files with 14 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import sanitizeHtml from 'sanitize-html';
|
import sanitizeHtml from 'sanitize-html';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { AbuseUserReportsRepository } from '@/models/_.js';
|
import type { AbuseUserReportsRepository, UserProfilesRepository } from '@/models/_.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
@ -59,6 +59,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
@Inject(DI.abuseUserReportsRepository)
|
@Inject(DI.abuseUserReportsRepository)
|
||||||
private abuseUserReportsRepository: AbuseUserReportsRepository,
|
private abuseUserReportsRepository: AbuseUserReportsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.userProfilesRepository)
|
||||||
|
private userProfilesRepository: UserProfilesRepository,
|
||||||
|
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
private metaService: MetaService,
|
private metaService: MetaService,
|
||||||
private emailService: EmailService,
|
private emailService: EmailService,
|
||||||
|
@ -101,11 +104,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
reporterId: report.reporterId,
|
reporterId: report.reporterId,
|
||||||
comment: report.comment,
|
comment: report.comment,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const profile = await this.userProfilesRepository.findOneBy({ userId: moderator.id });
|
||||||
|
|
||||||
|
if (profile?.email) {
|
||||||
|
this.emailService.sendEmail(profile.email, 'New abuse report',
|
||||||
|
sanitizeHtml(ps.comment),
|
||||||
|
sanitizeHtml(ps.comment));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
if (meta.email) {
|
if (meta.maintainerEmail) {
|
||||||
this.emailService.sendEmail(meta.email, 'New abuse report',
|
this.emailService.sendEmail(meta.maintainerEmail, 'New abuse report',
|
||||||
sanitizeHtml(ps.comment),
|
sanitizeHtml(ps.comment),
|
||||||
sanitizeHtml(ps.comment));
|
sanitizeHtml(ps.comment));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue