diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-04 11:48:12 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-04 11:48:12 +0100 |
commit | c883db6d038a8510205f5f13ef46fb5a1c9e8288 (patch) | |
tree | d8becd3b5cf3bddf14559f062d7ca4f96d1b25c3 /server/helpers/custom-validators/activitypub | |
parent | b5206dfc455c119b0dcb897bd7144be6ea4d999d (diff) | |
download | PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.tar.gz PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.tar.zst PeerTube-c883db6d038a8510205f5f13ef46fb5a1c9e8288.zip |
Move deleted comment on new follow tests
Diffstat (limited to 'server/helpers/custom-validators/activitypub')
-rw-r--r-- | server/helpers/custom-validators/activitypub/video-comments.ts | 18 |
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' | |||
3 | import { exists, isArray, isDateValid } from '../misc' | 3 | import { exists, isArray, isDateValid } from '../misc' |
4 | import { isActivityPubUrlValid } from './misc' | 4 | import { isActivityPubUrlValid } from './misc' |
5 | 5 | ||
6 | function 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 | |||
14 | function sanitizeAndCheckVideoCommentObject (comment: any) { | 6 | function 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 | |||
55 | function 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 | } | ||