From 19a3b914f19812a082e2f47d31c66fb1d9771736 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Mar 2018 11:29:46 +0100 Subject: Change video abuse API response --- server/models/video/video-abuse.ts | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'server/models/video') 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 @@ import { AfterCreate, AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' import { VideoAbuseObject } from '../../../shared/models/activitypub/objects' +import { VideoAbuse } from '../../../shared/models/videos' 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' @@ -83,24 +83,17 @@ export class VideoAbuseModel extends Model { }) } - toFormattedJSON () { - let reporterServerHost - - if (this.Account.Actor.Server) { - reporterServerHost = this.Account.Actor.Server.host - } else { - // It means it's our video - reporterServerHost = CONFIG.WEBSERVER.HOST - } - + toFormattedJSON (): VideoAbuse { return { id: this.id, reason: this.reason, - reporterUsername: this.Account.name, - reporterServerHost, - videoId: this.Video.id, - videoUUID: this.Video.uuid, - videoName: this.Video.name, + reporterAccount: this.Account.toFormattedJSON(), + video: { + id: this.Video.id, + uuid: this.Video.uuid, + url: this.Video.url, + name: this.Video.name + }, createdAt: this.createdAt } } -- cgit v1.2.3