aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-abuse.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-16 17:04:19 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit21e0727a84734cb0c81c1c9bb22a49b13e46fe5f (patch)
tree088da51cadbffe3ac64414b407e161f58b53bde7 /server/models/video/video-abuse.ts
parentd7d5611c8a23de9b483f0437ad3469afef7b8805 (diff)
downloadPeerTube-21e0727a84734cb0c81c1c9bb22a49b13e46fe5f.tar.gz
PeerTube-21e0727a84734cb0c81c1c9bb22a49b13e46fe5f.tar.zst
PeerTube-21e0727a84734cb0c81c1c9bb22a49b13e46fe5f.zip
Federate video abuses
Diffstat (limited to 'server/models/video/video-abuse.ts')
-rw-r--r--server/models/video/video-abuse.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index f3fdeab52..e8f4f9a67 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -10,10 +10,12 @@ import {
10 10
11 VideoAbuseMethods 11 VideoAbuseMethods
12} from './video-abuse-interface' 12} from './video-abuse-interface'
13import { VideoAbuseObject } from '../../../shared/models/activitypub/objects/video-abuse-object'
13 14
14let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes> 15let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes>
15let toFormattedJSON: VideoAbuseMethods.ToFormattedJSON 16let toFormattedJSON: VideoAbuseMethods.ToFormattedJSON
16let listForApi: VideoAbuseMethods.ListForApi 17let listForApi: VideoAbuseMethods.ListForApi
18let toActivityPubObject: VideoAbuseMethods.ToActivityPubObject
17 19
18export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { 20export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
19 VideoAbuse = sequelize.define<VideoAbuseInstance, VideoAbuseAttributes>('VideoAbuse', 21 VideoAbuse = sequelize.define<VideoAbuseInstance, VideoAbuseAttributes>('VideoAbuse',
@@ -47,7 +49,8 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
47 listForApi 49 listForApi
48 ] 50 ]
49 const instanceMethods = [ 51 const instanceMethods = [
50 toFormattedJSON 52 toFormattedJSON,
53 toActivityPubObject
51 ] 54 ]
52 addMethodsToModel(VideoAbuse, classMethods, instanceMethods) 55 addMethodsToModel(VideoAbuse, classMethods, instanceMethods)
53 56
@@ -80,6 +83,16 @@ toFormattedJSON = function (this: VideoAbuseInstance) {
80 return json 83 return json
81} 84}
82 85
86toActivityPubObject = function (this: VideoAbuseInstance) {
87 const videoAbuseObject: VideoAbuseObject = {
88 type: 'Flag' as 'Flag',
89 content: this.reason,
90 object: this.Video.url
91 }
92
93 return videoAbuseObject
94}
95
83// ------------------------------ STATICS ------------------------------ 96// ------------------------------ STATICS ------------------------------
84 97
85function associate (models) { 98function associate (models) {