aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/notifier.ts3
-rw-r--r--server/middlewares/validators/abuse.ts2
-rw-r--r--server/tests/api/check-params/abuses.ts1
-rw-r--r--server/types/models/moderation/abuse.ts6
-rw-r--r--server/typings/express/index.d.ts5
-rw-r--r--support/doc/api/openapi.yaml120
6 files changed, 118 insertions, 19 deletions
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts
index 9c2f16c27..1da81a535 100644
--- a/server/lib/notifier.ts
+++ b/server/lib/notifier.ts
@@ -1,4 +1,4 @@
1import { AbuseMessageModel } from '@server/models/abuse/abuse-message' 1import { AccountModel } from '@server/models/account/account'
2import { getServerActor } from '@server/models/application/application' 2import { getServerActor } from '@server/models/application/application'
3import { ServerBlocklistModel } from '@server/models/server/server-blocklist' 3import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
4import { 4import {
@@ -24,7 +24,6 @@ import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../type
24import { isBlockedByServerOrAccount } from './blocklist' 24import { isBlockedByServerOrAccount } from './blocklist'
25import { Emailer } from './emailer' 25import { Emailer } from './emailer'
26import { PeerTubeSocket } from './peertube-socket' 26import { PeerTubeSocket } from './peertube-socket'
27import { AccountModel } from '@server/models/account/account'
28 27
29class Notifier { 28class Notifier {
30 29
diff --git a/server/middlewares/validators/abuse.ts b/server/middlewares/validators/abuse.ts
index 2a096e0af..f99d850a5 100644
--- a/server/middlewares/validators/abuse.ts
+++ b/server/middlewares/validators/abuse.ts
@@ -208,7 +208,7 @@ const checkAbuseValidForMessagesValidator = [
208 const abuse = res.locals.abuse 208 const abuse = res.locals.abuse
209 if (abuse.ReporterAccount.isOwned() === false) { 209 if (abuse.ReporterAccount.isOwned() === false) {
210 return res.status(400).json({ 210 return res.status(400).json({
211 error: 'This abuse was created by a user of your instance.', 211 error: 'This abuse was created by a user of your instance.'
212 }) 212 })
213 } 213 }
214 214
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 0ef8f6cac..1f040bbcf 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -427,4 +427,3 @@ describe('Test abuses API validators', function () {
427 await cleanupTests([ server ]) 427 await cleanupTests([ server ])
428 }) 428 })
429}) 429})
430
diff --git a/server/types/models/moderation/abuse.ts b/server/types/models/moderation/abuse.ts
index 5409dfd6b..6fd83684c 100644
--- a/server/types/models/moderation/abuse.ts
+++ b/server/types/models/moderation/abuse.ts
@@ -1,11 +1,11 @@
1import { VideoAbuseModel } from '@server/models/abuse/video-abuse' 1import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
2import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse' 2import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
3import { VideoCommentModel } from '@server/models/video/video-comment'
3import { PickWith } from '@shared/core-utils' 4import { PickWith } from '@shared/core-utils'
4import { AbuseModel } from '../../../models/abuse/abuse' 5import { AbuseModel } from '../../../models/abuse/abuse'
5import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl, MAccount } from '../account' 6import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account'
6import { MCommentOwner, MCommentUrl, MVideoUrl, MCommentOwnerVideo, MComment, MCommentVideo } from '../video' 7import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video'
7import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video' 8import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
8import { VideoCommentModel } from '@server/models/video/video-comment'
9 9
10type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M> 10type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>
11type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M> 11type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
diff --git a/server/typings/express/index.d.ts b/server/typings/express/index.d.ts
index d95b8925d..cd8e544e0 100644
--- a/server/typings/express/index.d.ts
+++ b/server/typings/express/index.d.ts
@@ -1,7 +1,7 @@
1import { RegisterServerAuthExternalOptions } from '@server/types' 1import { RegisterServerAuthExternalOptions } from '@server/types'
2import { 2import {
3 MAbuse,
4 MAbuseMessage, 3 MAbuseMessage,
4 MAbuseReporter,
5 MAccountBlocklist, 5 MAccountBlocklist,
6 MActorUrl, 6 MActorUrl,
7 MStreamingPlaylist, 7 MStreamingPlaylist,
@@ -9,8 +9,7 @@ import {
9 MVideoFile, 9 MVideoFile,
10 MVideoImmutable, 10 MVideoImmutable,
11 MVideoPlaylistFull, 11 MVideoPlaylistFull,
12 MVideoPlaylistFullSummary, 12 MVideoPlaylistFullSummary
13 MAbuseReporter
14} from '@server/types/models' 13} from '@server/types/models'
15import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' 14import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
16import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server' 15import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index ad4d58e4b..ec2fe9155 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -1474,6 +1474,38 @@ paths:
1474 description: HTTP or Torrent/magnetURI import not enabled 1474 description: HTTP or Torrent/magnetURI import not enabled
1475 '400': 1475 '400':
1476 description: '`magnetUri` or `targetUrl` or a torrent file missing' 1476 description: '`magnetUri` or `targetUrl` or a torrent file missing'
1477
1478 /users/me/abuses:
1479 get:
1480 summary: List my abuses
1481 security:
1482 - OAuth2: []
1483 tags:
1484 - Abuses
1485 - My User
1486 parameters:
1487 - name: id
1488 in: query
1489 description: only list the report with this id
1490 schema:
1491 type: integer
1492 - name: state
1493 in: query
1494 schema:
1495 $ref: '#/components/schemas/AbuseStateSet'
1496 - $ref: '#/components/parameters/start'
1497 - $ref: '#/components/parameters/count'
1498 - $ref: '#/components/parameters/abusesSort'
1499 responses:
1500 '200':
1501 description: successful operation
1502 content:
1503 application/json:
1504 schema:
1505 type: array
1506 items:
1507 $ref: '#/components/schemas/Abuse'
1508
1477 /abuses: 1509 /abuses:
1478 get: 1510 get:
1479 summary: List abuses 1511 summary: List abuses
@@ -1501,13 +1533,8 @@ paths:
1501 type: string 1533 type: string
1502 - name: state 1534 - name: state
1503 in: query 1535 in: query
1504 description: 'The abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`)'
1505 schema: 1536 schema:
1506 type: integer 1537 $ref: '#/components/schemas/AbuseStateSet'
1507 enum:
1508 - 1
1509 - 2
1510 - 3
1511 - name: searchReporter 1538 - name: searchReporter
1512 in: query 1539 in: query
1513 description: only list reports of a specific reporter 1540 description: only list reports of a specific reporter
@@ -1556,7 +1583,7 @@ paths:
1556 schema: 1583 schema:
1557 type: array 1584 type: array
1558 items: 1585 items:
1559 $ref: '#/components/schemas/VideoAbuse' 1586 $ref: '#/components/schemas/Abuse'
1560 1587
1561 post: 1588 post:
1562 summary: Report an abuse 1589 summary: Report an abuse
@@ -1653,6 +1680,61 @@ paths:
1653 description: successful operation 1680 description: successful operation
1654 '404': 1681 '404':
1655 description: block not found 1682 description: block not found
1683 '/abuses/{abuseId}/messages':
1684 get:
1685 summary: List messages of an abuse
1686 security:
1687 - OAuth2: []
1688 tags:
1689 - Abuses
1690 parameters:
1691 - $ref: '#/components/parameters/abuseId'
1692 responses:
1693 '200':
1694 description: successful operation
1695 content:
1696 application/json:
1697 schema:
1698 type: array
1699 items:
1700 $ref: '#/components/schemas/AbuseMessage'
1701
1702 post:
1703 summary: Add message to an abuse
1704 security:
1705 - OAuth2: []
1706 tags:
1707 - Abuses
1708 requestBody:
1709 required: true
1710 content:
1711 application/json:
1712 schema:
1713 type: object
1714 properties:
1715 message:
1716 description: Message to send
1717 type: string
1718 required:
1719 - message
1720 responses:
1721 '200':
1722 description: successful operation
1723 '400':
1724 description: incorrect request parameters
1725 '/abuses/{abuseId}/messages/{abuseMessageId}':
1726 delete:
1727 summary: Delete an abuse message
1728 security:
1729 - OAuth2: []
1730 tags:
1731 - Abuses
1732 parameters:
1733 - $ref: '#/components/parameters/abuseId'
1734 - $ref: '#/components/parameters/abuseMessageId'
1735 responses:
1736 '204':
1737 description: successful operation
1656 1738
1657 '/videos/{id}/blacklist': 1739 '/videos/{id}/blacklist':
1658 post: 1740 post:
@@ -3332,6 +3414,13 @@ components:
3332 description: Abuse id 3414 description: Abuse id
3333 schema: 3415 schema:
3334 type: integer 3416 type: integer
3417 abuseMessageId:
3418 name: abuseMessageId
3419 in: path
3420 required: true
3421 description: Abuse message id
3422 schema:
3423 type: integer
3335 captionLanguage: 3424 captionLanguage:
3336 name: captionLanguage 3425 name: captionLanguage
3337 in: path 3426 in: path
@@ -3599,7 +3688,7 @@ components:
3599 - 1 3688 - 1
3600 - 2 3689 - 2
3601 - 3 3690 - 3
3602 description: 'The video playlist privacy (Pending = `1`, Rejected = `2`, Accepted = `3`)' 3691 description: 'The abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`)'
3603 AbuseStateConstant: 3692 AbuseStateConstant:
3604 properties: 3693 properties:
3605 id: 3694 id:
@@ -3960,7 +4049,7 @@ components:
3960 format: date-time 4049 format: date-time
3961 video: 4050 video:
3962 $ref: '#/components/schemas/Video' 4051 $ref: '#/components/schemas/Video'
3963 VideoAbuse: 4052 Abuse:
3964 properties: 4053 properties:
3965 id: 4054 id:
3966 type: integer 4055 type: integer
@@ -3991,6 +4080,19 @@ components:
3991 createdAt: 4080 createdAt:
3992 type: string 4081 type: string
3993 format: date-time 4082 format: date-time
4083 AbuseMessage:
4084 properties:
4085 id:
4086 type: integer
4087 message:
4088 type: string
4089 byModerator:
4090 type: boolean
4091 createdAt:
4092 type: string
4093 format: date-time
4094 account:
4095 $ref: '#/components/schemas/AccountSummary'
3994 VideoBlacklist: 4096 VideoBlacklist:
3995 properties: 4097 properties:
3996 id: 4098 id: