diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-26 11:20:46 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-26 11:20:46 +0100 |
commit | 66ee325f573feeb61bc6c945151bf64dec6b9698 (patch) | |
tree | 30bfd8a388632a37db22328d7c7bad63fa4f76e4 /server/helpers/custom-validators | |
parent | ce487e1e3b9ae46b4bea2297e13d6f8c5b3f8aeb (diff) | |
download | PeerTube-66ee325f573feeb61bc6c945151bf64dec6b9698.tar.gz PeerTube-66ee325f573feeb61bc6c945151bf64dec6b9698.tar.zst PeerTube-66ee325f573feeb61bc6c945151bf64dec6b9698.zip |
Only accept public comments
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/activitypub/video-comments.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/helpers/custom-validators/activitypub/video-comments.ts index cbd4dac5c..079fee434 100644 --- a/server/helpers/custom-validators/activitypub/video-comments.ts +++ b/server/helpers/custom-validators/activitypub/video-comments.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as validator from 'validator' | 1 | import * as validator from 'validator' |
2 | import { exists, isDateValid } from '../misc' | 2 | import { ACTIVITY_PUB } from '../../../initializers' |
3 | import { exists, isArray, isDateValid } from '../misc' | ||
3 | import { isActivityPubUrlValid, isBaseActivityValid } from './misc' | 4 | import { isActivityPubUrlValid, isBaseActivityValid } from './misc' |
4 | 5 | ||
5 | function isVideoCommentCreateActivityValid (activity: any) { | 6 | function isVideoCommentCreateActivityValid (activity: any) { |
@@ -13,7 +14,9 @@ function isVideoCommentObjectValid (comment: any) { | |||
13 | isCommentContentValid(comment.content) && | 14 | isCommentContentValid(comment.content) && |
14 | isActivityPubUrlValid(comment.inReplyTo) && | 15 | isActivityPubUrlValid(comment.inReplyTo) && |
15 | isDateValid(comment.published) && | 16 | isDateValid(comment.published) && |
16 | isActivityPubUrlValid(comment.url) | 17 | isActivityPubUrlValid(comment.url) && |
18 | isArray(comment.to) && | ||
19 | comment.to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 // Only accept public comments | ||
17 | } | 20 | } |
18 | 21 | ||
19 | function isVideoCommentDeleteActivityValid (activity: any) { | 22 | function isVideoCommentDeleteActivityValid (activity: any) { |