aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-04 11:48:12 +0100
committerChocobozzz <me@florianbigard.com>2019-12-04 11:48:12 +0100
commitc883db6d038a8510205f5f13ef46fb5a1c9e8288 (patch)
treed8becd3b5cf3bddf14559f062d7ca4f96d1b25c3 /server/helpers/custom-validators
parentb5206dfc455c119b0dcb897bd7144be6ea4d999d (diff)
downloadPeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.tar.gz
PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.tar.zst
PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.zip
Move deleted comment on new follow tests
Diffstat (limited to 'server/helpers/custom-validators')
-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}