aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
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 }