-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)
if (typeof comment.url === 'object') comment.url = comment.url.href || comment.url.url
else comment.url = comment.id
}
+}
+
+function isCommentTypeValid (comment: any): boolean {
+ if (comment.type === 'Note') return true
- return
+ if (comment.type === 'Tombstone' && comment.formerType === 'Note') return true
+
+ return false
}