]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/activitypub/video-comments.ts
Add ability to list redundancies
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / activitypub / video-comments.ts
index 96655c3f82ecb7ddf3a2e714f658f3502ab262fa..aa3c246b5f69ccbcdb24f094873b3e15f06010e7 100644 (file)
@@ -1,20 +1,12 @@
-import * as validator from 'validator'
+import validator from 'validator'
 import { ACTIVITY_PUB } from '../../../initializers/constants'
 import { exists, isArray, isDateValid } from '../misc'
 import { isActivityPubUrlValid } from './misc'
 
-function isTypeValid (comment: any): boolean {
-  if (comment.type === 'Note') return true
-
-  if (comment.type === 'Tombstone' && comment.formerType === 'Note') return true
-
-  return false
-}
-
 function sanitizeAndCheckVideoCommentObject (comment: any) {
   if (!comment) return false
 
-  if (!isTypeValid(comment)) return false
+  if (!isCommentTypeValid(comment)) return false
 
   normalizeComment(comment)
 
@@ -59,3 +51,11 @@ function normalizeComment (comment: any) {
 
   return
 }
+
+function isCommentTypeValid (comment: any): boolean {
+  if (comment.type === 'Note') return true
+
+  if (comment.type === 'Tombstone' && comment.formerType === 'Note') return true
+
+  return false
+}