aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-11 14:41:55 +0100
committerChocobozzz <me@florianbigard.com>2019-02-11 15:16:39 +0100
commit7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88 (patch)
treeed94c1fb00a85a1f25c15b9a82831f4999e72948 /server/helpers
parent6913f69134947432a192890b2de7c2d48094e85c (diff)
downloadPeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.tar.gz
PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.tar.zst
PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.zip
Add originallyPublishedAt unit tests
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/activitypub.ts3
-rw-r--r--server/helpers/custom-validators/activitypub/videos.ts1
2 files changed, 3 insertions, 1 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index 62d78373e..e850efe13 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -34,7 +34,8 @@ function activityPubContextify <T> (data: T) {
34 expires: 'sc:expires', 34 expires: 'sc:expires',
35 support: 'sc:Text', 35 support: 'sc:Text',
36 CacheFile: 'pt:CacheFile', 36 CacheFile: 'pt:CacheFile',
37 Infohash: 'pt:Infohash' 37 Infohash: 'pt:Infohash',
38 originallyPublishedAt: 'sc:DateTime'
38 }, 39 },
39 { 40 {
40 likes: { 41 likes: {
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts
index 53ad0588d..d94333151 100644
--- a/server/helpers/custom-validators/activitypub/videos.ts
+++ b/server/helpers/custom-validators/activitypub/videos.ts
@@ -54,6 +54,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) {
54 isBooleanValid(video.downloadEnabled) && 54 isBooleanValid(video.downloadEnabled) &&
55 isDateValid(video.published) && 55 isDateValid(video.published) &&
56 isDateValid(video.updated) && 56 isDateValid(video.updated) &&
57 (!video.originallyPublishedAt || isDateValid(video.originallyPublishedAt)) &&
57 (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) && 58 (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) &&
58 isRemoteVideoIconValid(video.icon) && 59 isRemoteVideoIconValid(video.icon) &&
59 video.url.length !== 0 && 60 video.url.length !== 0 &&