aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-24 15:05:51 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-31 11:35:19 +0200
commitedbc9325462ddf4536775871ebc25e06f46612d1 (patch)
tree9671dd51303e75d48d4f4f9a1df7a1960e33780d /server/controllers/api/videos
parent20516920d2b72c8a18bc24b9740f7176aa962da2 (diff)
downloadPeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.tar.gz
PeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.tar.zst
PeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.zip
Add server API to abuse messages
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r--server/controllers/api/videos/abuse.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index b92a66360..9c4d00849 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -2,7 +2,6 @@ import * as express from 'express'
2import { AbuseModel } from '@server/models/abuse/abuse' 2import { AbuseModel } from '@server/models/abuse/abuse'
3import { getServerActor } from '@server/models/application/application' 3import { getServerActor } from '@server/models/application/application'
4import { AbuseCreate, UserRight, VideoAbuseCreate } from '../../../../shared' 4import { AbuseCreate, UserRight, VideoAbuseCreate } from '../../../../shared'
5import { getFormattedObjects } from '../../../helpers/utils'
6import { 5import {
7 abusesSortValidator, 6 abusesSortValidator,
8 asyncMiddleware, 7 asyncMiddleware,
@@ -63,7 +62,7 @@ async function listVideoAbuses (req: express.Request, res: express.Response) {
63 const user = res.locals.oauth.token.user 62 const user = res.locals.oauth.token.user
64 const serverActor = await getServerActor() 63 const serverActor = await getServerActor()
65 64
66 const resultList = await AbuseModel.listForApi({ 65 const resultList = await AbuseModel.listForAdminApi({
67 start: req.query.start, 66 start: req.query.start,
68 count: req.query.count, 67 count: req.query.count,
69 sort: req.query.sort, 68 sort: req.query.sort,
@@ -81,7 +80,10 @@ async function listVideoAbuses (req: express.Request, res: express.Response) {
81 user 80 user
82 }) 81 })
83 82
84 return res.json(getFormattedObjects(resultList.data, resultList.total)) 83 return res.json({
84 total: resultList.total,
85 data: resultList.data.map(d => d.toFormattedAdminJSON())
86 })
85} 87}
86 88
87async function updateVideoAbuse (req: express.Request, res: express.Response) { 89async function updateVideoAbuse (req: express.Request, res: express.Response) {