aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/activitypub/video-comments.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/helpers/custom-validators/activitypub/video-comments.ts
index e04c5388f..96655c3f8 100644
--- a/server/helpers/custom-validators/activitypub/video-comments.ts
+++ b/server/helpers/custom-validators/activitypub/video-comments.ts
@@ -3,11 +3,28 @@ import { ACTIVITY_PUB } from '../../../initializers/constants'
3import { exists, isArray, isDateValid } from '../misc' 3import { exists, isArray, isDateValid } from '../misc'
4import { isActivityPubUrlValid } from './misc' 4import { isActivityPubUrlValid } from './misc'
5 5
6function isTypeValid (comment: any): boolean {
7 if (comment.type === 'Note') return true
8
9 if (comment.type === 'Tombstone' && comment.formerType === 'Note') return true
10
11 return false
12}
13
6function sanitizeAndCheckVideoCommentObject (comment: any) { 14function sanitizeAndCheckVideoCommentObject (comment: any) {
7 if (!comment || comment.type !== 'Note') return false 15 if (!comment) return false
16
17 if (!isTypeValid(comment)) return false
8 18
9 normalizeComment(comment) 19 normalizeComment(comment)
10 20
21 if (comment.type === 'Tombstone') {
22 return isActivityPubUrlValid(comment.id) &&
23 isDateValid(comment.published) &&
24 isDateValid(comment.deleted) &&
25 isActivityPubUrlValid(comment.url)
26 }
27
11 return isActivityPubUrlValid(comment.id) && 28 return isActivityPubUrlValid(comment.id) &&
12 isCommentContentValid(comment.content) && 29 isCommentContentValid(comment.content) &&
13 isActivityPubUrlValid(comment.inReplyTo) && 30 isActivityPubUrlValid(comment.inReplyTo) &&