aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-27 11:40:30 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-31 11:35:19 +0200
commit94148c9028829b5576a5dcbfba2c7fb9cf6443d3 (patch)
tree2774f272329111abd03e8441ff936da11fb1a3f3 /server/controllers
parent441e453ae53e491b09c9b09b00b041788176ce64 (diff)
downloadPeerTube-94148c9028829b5576a5dcbfba2c7fb9cf6443d3.tar.gz
PeerTube-94148c9028829b5576a5dcbfba2c7fb9cf6443d3.tar.zst
PeerTube-94148c9028829b5576a5dcbfba2c7fb9cf6443d3.zip
Add abuse messages management in my account
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/abuse.ts4
-rw-r--r--server/controllers/api/users/my-abuses.ts2
2 files changed, 5 insertions, 1 deletions
diff --git a/server/controllers/api/abuse.ts b/server/controllers/api/abuse.ts
index 50d068157..72e62fc0b 100644
--- a/server/controllers/api/abuse.ts
+++ b/server/controllers/api/abuse.ts
@@ -16,6 +16,7 @@ import {
16 asyncMiddleware, 16 asyncMiddleware,
17 asyncRetryTransactionMiddleware, 17 asyncRetryTransactionMiddleware,
18 authenticate, 18 authenticate,
19 checkAbuseValidForMessagesValidator,
19 deleteAbuseMessageValidator, 20 deleteAbuseMessageValidator,
20 ensureUserHasRight, 21 ensureUserHasRight,
21 getAbuseValidator, 22 getAbuseValidator,
@@ -58,12 +59,14 @@ abuseRouter.delete('/:id',
58abuseRouter.get('/:id/messages', 59abuseRouter.get('/:id/messages',
59 authenticate, 60 authenticate,
60 asyncMiddleware(getAbuseValidator), 61 asyncMiddleware(getAbuseValidator),
62 checkAbuseValidForMessagesValidator,
61 asyncRetryTransactionMiddleware(listAbuseMessages) 63 asyncRetryTransactionMiddleware(listAbuseMessages)
62) 64)
63 65
64abuseRouter.post('/:id/messages', 66abuseRouter.post('/:id/messages',
65 authenticate, 67 authenticate,
66 asyncMiddleware(getAbuseValidator), 68 asyncMiddleware(getAbuseValidator),
69 checkAbuseValidForMessagesValidator,
67 addAbuseMessageValidator, 70 addAbuseMessageValidator,
68 asyncRetryTransactionMiddleware(addAbuseMessage) 71 asyncRetryTransactionMiddleware(addAbuseMessage)
69) 72)
@@ -71,6 +74,7 @@ abuseRouter.post('/:id/messages',
71abuseRouter.delete('/:id/messages/:messageId', 74abuseRouter.delete('/:id/messages/:messageId',
72 authenticate, 75 authenticate,
73 asyncMiddleware(getAbuseValidator), 76 asyncMiddleware(getAbuseValidator),
77 checkAbuseValidForMessagesValidator,
74 asyncMiddleware(deleteAbuseMessageValidator), 78 asyncMiddleware(deleteAbuseMessageValidator),
75 asyncRetryTransactionMiddleware(deleteAbuseMessage) 79 asyncRetryTransactionMiddleware(deleteAbuseMessage)
76) 80)
diff --git a/server/controllers/api/users/my-abuses.ts b/server/controllers/api/users/my-abuses.ts
index e43fc483e..fcd0ce3fc 100644
--- a/server/controllers/api/users/my-abuses.ts
+++ b/server/controllers/api/users/my-abuses.ts
@@ -43,6 +43,6 @@ async function listMyAbuses (req: express.Request, res: express.Response) {
43 43
44 return res.json({ 44 return res.json({
45 total: resultList.total, 45 total: resultList.total,
46 data: resultList.data.map(d => d.toFormattedAdminJSON()) 46 data: resultList.data.map(d => d.toFormattedUserJSON())
47 }) 47 })
48} 48}