aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-12 11:29:46 +0100
committerChocobozzz <me@florianbigard.com>2018-03-12 11:44:28 +0100
commit19a3b914f19812a082e2f47d31c66fb1d9771736 (patch)
tree7e60fbec3b4fff27e018682bd36c0d5e67aed228 /server/models
parentf2c3f7cd8a592ca1949e4f73717f17132a16c292 (diff)
downloadPeerTube-19a3b914f19812a082e2f47d31c66fb1d9771736.tar.gz
PeerTube-19a3b914f19812a082e2f47d31c66fb1d9771736.tar.zst
PeerTube-19a3b914f19812a082e2f47d31c66fb1d9771736.zip
Change video abuse API response
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-abuse.ts25
1 files changed, 9 insertions, 16 deletions
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index 65b734442..a6319bb79 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -1,7 +1,7 @@
1import { AfterCreate, AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' 1import { AfterCreate, AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
2import { VideoAbuseObject } from '../../../shared/models/activitypub/objects' 2import { VideoAbuseObject } from '../../../shared/models/activitypub/objects'
3import { VideoAbuse } from '../../../shared/models/videos'
3import { isVideoAbuseReasonValid } from '../../helpers/custom-validators/videos' 4import { isVideoAbuseReasonValid } from '../../helpers/custom-validators/videos'
4import { CONFIG } from '../../initializers'
5import { Emailer } from '../../lib/emailer' 5import { Emailer } from '../../lib/emailer'
6import { AccountModel } from '../account/account' 6import { AccountModel } from '../account/account'
7import { getSort, throwIfNotValid } from '../utils' 7import { getSort, throwIfNotValid } from '../utils'
@@ -83,24 +83,17 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {
83 }) 83 })
84 } 84 }
85 85
86 toFormattedJSON () { 86 toFormattedJSON (): VideoAbuse {
87 let reporterServerHost
88
89 if (this.Account.Actor.Server) {
90 reporterServerHost = this.Account.Actor.Server.host
91 } else {
92 // It means it's our video
93 reporterServerHost = CONFIG.WEBSERVER.HOST
94 }
95
96 return { 87 return {
97 id: this.id, 88 id: this.id,
98 reason: this.reason, 89 reason: this.reason,
99 reporterUsername: this.Account.name, 90 reporterAccount: this.Account.toFormattedJSON(),
100 reporterServerHost, 91 video: {
101 videoId: this.Video.id, 92 id: this.Video.id,
102 videoUUID: this.Video.uuid, 93 uuid: this.Video.uuid,
103 videoName: this.Video.name, 94 url: this.Video.url,
95 name: this.Video.name
96 },
104 createdAt: this.createdAt 97 createdAt: this.createdAt
105 } 98 }
106 } 99 }