mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Add server API to abuse messages
This commit is contained in:
@@ -5,7 +5,7 @@ import { chain } from 'lodash'
|
||||
import * as path from 'path'
|
||||
import * as winston from 'winston'
|
||||
import { AUDIT_LOG_FILENAME } from '@server/initializers/constants'
|
||||
import { Abuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared'
|
||||
import { AdminAbuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared'
|
||||
import { CustomConfig } from '../../shared/models/server/custom-config.model'
|
||||
import { VideoComment } from '../../shared/models/videos/video-comment.model'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
@@ -219,7 +219,7 @@ const abuseKeysToKeep = [
|
||||
'createdAt'
|
||||
]
|
||||
class AbuseAuditView extends EntityAuditView {
|
||||
constructor (private readonly abuse: Abuse) {
|
||||
constructor (private readonly abuse: AdminAbuse) {
|
||||
super(abuseKeysToKeep, 'abuse', abuse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants'
|
||||
import { exists, isArray } from './misc'
|
||||
|
||||
const ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSES
|
||||
const ABUSE_MESSAGES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSE_MESSAGES
|
||||
|
||||
function isAbuseReasonValid (value: string) {
|
||||
return exists(value) && validator.isLength(value, ABUSES_CONSTRAINTS_FIELDS.REASON)
|
||||
@@ -46,13 +47,18 @@ function isAbuseVideoIsValid (value: AbuseVideoIs) {
|
||||
)
|
||||
}
|
||||
|
||||
function isAbuseMessageValid (value: string) {
|
||||
return exists(value) && validator.isLength(value, ABUSE_MESSAGES_CONSTRAINTS_FIELDS.MESSAGE)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isAbuseReasonValid,
|
||||
isAbuseFilterValid,
|
||||
isAbusePredefinedReasonValid,
|
||||
areAbusePredefinedReasonsValid as isAbusePredefinedReasonsValid,
|
||||
isAbuseMessageValid,
|
||||
areAbusePredefinedReasonsValid,
|
||||
isAbuseTimestampValid,
|
||||
isAbuseTimestampCoherent,
|
||||
isAbuseModerationCommentValid,
|
||||
|
||||
Reference in New Issue
Block a user