From 8e13fa7d09e9925b4559cbba6c5d72c5ff1bd391 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 15 Nov 2017 15:12:23 +0100 Subject: Add video abuse to activity pub --- server/helpers/activitypub.ts | 6 ++++-- server/helpers/custom-validators/videos.ts | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index 3e77e0581..de20ba55d 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts @@ -22,10 +22,11 @@ function generateThumbnailFromUrl (video: VideoInstance, icon: ActivityIconObjec return doRequestAndSaveToFile(options, thumbnailPath) } -function getActivityPubUrl (type: 'video' | 'videoChannel' | 'account', id: string) { +function getActivityPubUrl (type: 'video' | 'videoChannel' | 'account' | 'videoAbuse', id: string) { if (type === 'video') return CONFIG.WEBSERVER.URL + '/videos/watch/' + id else if (type === 'videoChannel') return CONFIG.WEBSERVER.URL + '/video-channels/' + id else if (type === 'account') return CONFIG.WEBSERVER.URL + '/account/' + id + else if (type === 'videoAbuse') return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + id return '' } @@ -134,7 +135,8 @@ function activityPubContextify (data: T) { 'nsfw': 'as:sensitive', 'language': 'http://schema.org/inLanguage', 'views': 'http://schema.org/Number', - 'size': 'http://schema.org/Number' + 'size': 'http://schema.org/Number', + 'VideoChannel': 'https://peertu.be/ns/VideoChannel' } ] }) diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index d68de6609..1505632da 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -112,10 +112,6 @@ function isVideoAbuseReasonValid (value: string) { return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.REASON) } -function isVideoAbuseReporterUsernameValid (value: string) { - return isUserUsernameValid(value) -} - function isVideoViewsValid (value: string) { return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS) } @@ -209,7 +205,6 @@ export { isVideoThumbnailDataValid, isVideoFileExtnameValid, isVideoAbuseReasonValid, - isVideoAbuseReporterUsernameValid, isVideoFile, isVideoViewsValid, isVideoLikesValid, -- cgit v1.2.3