X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-abuse.ts;h=cc7078ae7966541ecea1c3bb79a542af19fc178c;hb=ba75d268596bc7b289bacf1cc4cb53493d6ad444;hp=182971c4e018a2aa8aa0735d94a71940814c0d2e;hpb=09c93c2031ce4d7dee15f247b194f21346c7e615;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts index 182971c4e..cc7078ae7 100644 --- a/server/models/video/video-abuse.ts +++ b/server/models/video/video-abuse.ts @@ -1,7 +1,8 @@ -import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' +import { AfterCreate, AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' import { VideoAbuseObject } from '../../../shared/models/activitypub/objects' import { isVideoAbuseReasonValid } from '../../helpers/custom-validators/videos' import { CONFIG } from '../../initializers' +import { Emailer } from '../../lib/emailer' import { AccountModel } from '../account/account' import { getSort, throwIfNotValid } from '../utils' import { VideoModel } from './video' @@ -54,6 +55,11 @@ export class VideoAbuseModel extends Model { }) Video: VideoModel + @AfterCreate + static sendEmailNotification (instance: VideoAbuseModel) { + return Emailer.Instance.addVideoAbuseReport(instance.videoId) + } + static listForApi (start: number, count: number, sort: string) { const query = { offset: start,