diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-01 11:08:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-01 11:08:29 +0100 |
commit | ba75d268596bc7b289bacf1cc4cb53493d6ad444 (patch) | |
tree | f631ed9a871ce078cd94afb0b4fcfc1e356944ec /server/models/video/video-abuse.ts | |
parent | 09c93c2031ce4d7dee15f247b194f21346c7e615 (diff) | |
download | PeerTube-ba75d268596bc7b289bacf1cc4cb53493d6ad444.tar.gz PeerTube-ba75d268596bc7b289bacf1cc4cb53493d6ad444.tar.zst PeerTube-ba75d268596bc7b289bacf1cc4cb53493d6ad444.zip |
Send an email on video abuse report
Diffstat (limited to 'server/models/video/video-abuse.ts')
-rw-r--r-- | server/models/video/video-abuse.ts | 8 |
1 files changed, 7 insertions, 1 deletions
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 @@ | |||
1 | import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 1 | import { AfterCreate, AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | import { VideoAbuseObject } from '../../../shared/models/activitypub/objects' | 2 | import { VideoAbuseObject } from '../../../shared/models/activitypub/objects' |
3 | import { isVideoAbuseReasonValid } from '../../helpers/custom-validators/videos' | 3 | import { isVideoAbuseReasonValid } from '../../helpers/custom-validators/videos' |
4 | import { CONFIG } from '../../initializers' | 4 | import { CONFIG } from '../../initializers' |
5 | import { Emailer } from '../../lib/emailer' | ||
5 | import { AccountModel } from '../account/account' | 6 | import { AccountModel } from '../account/account' |
6 | import { getSort, throwIfNotValid } from '../utils' | 7 | import { getSort, throwIfNotValid } from '../utils' |
7 | import { VideoModel } from './video' | 8 | import { VideoModel } from './video' |
@@ -54,6 +55,11 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> { | |||
54 | }) | 55 | }) |
55 | Video: VideoModel | 56 | Video: VideoModel |
56 | 57 | ||
58 | @AfterCreate | ||
59 | static sendEmailNotification (instance: VideoAbuseModel) { | ||
60 | return Emailer.Instance.addVideoAbuseReport(instance.videoId) | ||
61 | } | ||
62 | |||
57 | static listForApi (start: number, count: number, sort: string) { | 63 | static listForApi (start: number, count: number, sort: string) { |
58 | const query = { | 64 | const query = { |
59 | offset: start, | 65 | offset: start, |