Only accept public comments
authorChocobozzz <me@florianbigard.com>
Fri, 26 Jan 2018 10:20:46 +0000 (11:20 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 26 Jan 2018 10:20:46 +0000 (11:20 +0100)
client/src/app/videos/+video-edit/video-add.component.ts
server/helpers/custom-validators/activitypub/video-comments.ts

index c6f0525c339a59fd8d9d56e18dac23498b9a04f9..3a9d932b863f9da07dcc4bfddaa73663d0562346 100644 (file)
@@ -206,6 +206,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy
     this.videoService.updateVideo(video)
       .subscribe(
         () => {
+          this.isUploadingVideo = false
           this.notificationsService.success('Success', 'Video published.')
           this.router.navigate([ '/videos/watch', video.uuid ])
         },
index cbd4dac5c30cbd47ad79a9e428adce7126374234..079fee43448cf48e3bbc037e318c3797d22a6dfd 100644 (file)
@@ -1,5 +1,6 @@
 import * as validator from 'validator'
-import { exists, isDateValid } from '../misc'
+import { ACTIVITY_PUB } from '../../../initializers'
+import { exists, isArray, isDateValid } from '../misc'
 import { isActivityPubUrlValid, isBaseActivityValid } from './misc'
 
 function isVideoCommentCreateActivityValid (activity: any) {
@@ -13,7 +14,9 @@ function isVideoCommentObjectValid (comment: any) {
     isCommentContentValid(comment.content) &&
     isActivityPubUrlValid(comment.inReplyTo) &&
     isDateValid(comment.published) &&
-    isActivityPubUrlValid(comment.url)
+    isActivityPubUrlValid(comment.url) &&
+    isArray(comment.to) &&
+    comment.to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 // Only accept public comments
 }
 
 function isVideoCommentDeleteActivityValid (activity: any) {