1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add server API to abuse messages

This commit is contained in:
Chocobozzz 2020-07-24 15:05:51 +02:00 committed by Chocobozzz
parent 20516920d2
commit edbc932546
28 changed files with 1054 additions and 209 deletions

View file

@ -26,8 +26,10 @@ export type BuildAbusesQueryOptions = {
state?: AbuseState
// accountIds
serverAccountId: number
userAccountId: number
serverAccountId?: number
userAccountId?: number
reporterAccountId?: number
}
function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'id') {
@ -45,7 +47,14 @@ function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' |
'LEFT JOIN "videoComment" ON "commentAbuse"."videoCommentId" = "videoComment"."id"'
]
whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')')
if (options.serverAccountId || options.userAccountId) {
whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')')
}
if (options.reporterAccountId) {
whereAnd.push('"abuse"."reporterAccountId" = :reporterAccountId')
replacements.reporterAccountId = options.reporterAccountId
}
if (options.search) {
const searchWhereOr = [