import { exists } from '@server/helpers/custom-validators/misc'
+import { forceNumber } from '@shared/core-utils'
import { AbuseFilter, AbuseState, AbuseVideoIs } from '@shared/models'
import { buildBlockedAccountSQL, buildDirectionAndField } from '../utils'
searchReporter?: string
searchReportee?: string
- // video releated
+ // video related
searchVideo?: string
searchVideoChannel?: string
videoIs?: AbuseVideoIs
'LEFT JOIN "videoBlacklist" ON "videoBlacklist"."videoId" = "video"."id"',
'LEFT JOIN "videoChannel" ON "video"."channelId" = "videoChannel"."id"',
'LEFT JOIN "account" "reporterAccount" ON "reporterAccount"."id" = "abuse"."reporterAccountId"',
- 'LEFT JOIN "account" "flaggedAccount" ON "flaggedAccount"."id" = "abuse"."reporterAccountId"',
+ 'LEFT JOIN "account" "flaggedAccount" ON "flaggedAccount"."id" = "abuse"."flaggedAccountId"',
'LEFT JOIN "commentAbuse" ON "commentAbuse"."abuseId" = "abuse"."id"',
'LEFT JOIN "videoComment" ON "commentAbuse"."videoCommentId" = "videoComment"."id"'
]
if (options.serverAccountId || options.userAccountId) {
- whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')')
+ whereAnd.push(
+ '"abuse"."reporterAccountId" IS NULL OR ' +
+ '"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')'
+ )
}
if (options.reporterAccountId) {
}
if (exists(options.count)) {
- const count = parseInt(options.count + '', 10)
+ const count = forceNumber(options.count)
suffix += `LIMIT ${count} `
}
if (exists(options.start)) {
- const start = parseInt(options.start + '', 10)
+ const start = forceNumber(options.start)
suffix += `OFFSET ${start} `
}
}