aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/activitypub')
-rw-r--r--server/helpers/custom-validators/activitypub/video-comments.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/helpers/custom-validators/activitypub/video-comments.ts
index 96655c3f8..ea780ca46 100644
--- a/server/helpers/custom-validators/activitypub/video-comments.ts
+++ b/server/helpers/custom-validators/activitypub/video-comments.ts
@@ -3,18 +3,10 @@ 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
14function sanitizeAndCheckVideoCommentObject (comment: any) { 6function sanitizeAndCheckVideoCommentObject (comment: any) {
15 if (!comment) return false 7 if (!comment) return false
16 8
17 if (!isTypeValid(comment)) return false 9 if (!isCommentTypeValid(comment)) return false
18 10
19 normalizeComment(comment) 11 normalizeComment(comment)
20 12
@@ -59,3 +51,11 @@ function normalizeComment (comment: any) {
59 51
60 return 52 return
61} 53}
54
55function isCommentTypeValid (comment: any): boolean {
56 if (comment.type === 'Note') return true
57
58 if (comment.type === 'Tombstone' && comment.formerType === 'Note') return true
59
60 return false
61}