import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'
-import { isVideoCommentObjectValid } from '../../helpers/custom-validators/activitypub/video-comments'
+import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'
import { logger } from '../../helpers/logger'
import { doRequest } from '../../helpers/requests'
import { ACTIVITY_PUB } from '../../initializers'
}
}
-async function addVideoComments (instance: VideoModel, commentUrls: string[]) {
+async function addVideoComments (commentUrls: string[], instance: VideoModel) {
for (const commentUrl of commentUrls) {
await addVideoComment(instance, commentUrl)
}
activityPub: true
})
- if (isVideoCommentObjectValid(body) === false) {
+ if (sanitizeAndCheckVideoCommentObject(body) === false) {
logger.debug('Remote video comment JSON is not valid.', { body })
return undefined
}
return { video, parents: comments }
} catch (err) {
- logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, err)
+ logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, { err })
if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) {
throw new Error('Recursion limit reached when resolving a thread')
activityPub: true
})
- if (isVideoCommentObjectValid(body) === false) {
+ if (sanitizeAndCheckVideoCommentObject(body) === false) {
throw new Error('Remote video comment JSON is not valid :' + JSON.stringify(body))
}