aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-28 18:50:44 +0200
committerChocobozzz <me@florianbigard.com>2018-05-28 18:50:44 +0200
commit53a613171e5d3e2d31c04d85ed883dd9a37cf1fb (patch)
tree7fbe33128110ccbe0f9c49c47ea2df394657f8a0 /server
parent1ab6d6bb6b78e4cd7079884fbf99aa89717dab26 (diff)
downloadPeerTube-53a613171e5d3e2d31c04d85ed883dd9a37cf1fb.tar.gz
PeerTube-53a613171e5d3e2d31c04d85ed883dd9a37cf1fb.tar.zst
PeerTube-53a613171e5d3e2d31c04d85ed883dd9a37cf1fb.zip
Fix publishedAt value after following a new instance
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/videos.ts1
-rw-r--r--server/tests/api/videos/multiple-servers.ts3
-rw-r--r--server/tests/utils/videos/videos.ts7
3 files changed, 11 insertions, 0 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index be6794cef..907f7e11e 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -93,6 +93,7 @@ async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelMode
93 channelId: videoChannel.id, 93 channelId: videoChannel.id,
94 duration: parseInt(duration, 10), 94 duration: parseInt(duration, 10),
95 createdAt: new Date(videoObject.published), 95 createdAt: new Date(videoObject.published),
96 publishedAt: new Date(videoObject.published),
96 // FIXME: updatedAt does not seems to be considered by Sequelize 97 // FIXME: updatedAt does not seems to be considered by Sequelize
97 updatedAt: new Date(videoObject.updated), 98 updatedAt: new Date(videoObject.updated),
98 views: videoObject.views, 99 views: videoObject.views,
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 94d627e26..fc7c0cb21 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -105,6 +105,7 @@ describe('Test multiple servers', function () {
105 await wait(10000) 105 await wait(10000)
106 106
107 // All servers should have this video 107 // All servers should have this video
108 let publishedAt: string = null
108 for (const server of servers) { 109 for (const server of servers) {
109 const isLocal = server.url === 'http://localhost:9001' 110 const isLocal = server.url === 'http://localhost:9001'
110 const checkAttributes = { 111 const checkAttributes = {
@@ -120,6 +121,7 @@ describe('Test multiple servers', function () {
120 host: 'localhost:9001' 121 host: 'localhost:9001'
121 }, 122 },
122 isLocal, 123 isLocal,
124 publishedAt,
123 duration: 10, 125 duration: 10,
124 tags: [ 'tag1p1', 'tag2p1' ], 126 tags: [ 'tag1p1', 'tag2p1' ],
125 privacy: VideoPrivacy.PUBLIC, 127 privacy: VideoPrivacy.PUBLIC,
@@ -145,6 +147,7 @@ describe('Test multiple servers', function () {
145 const video = videos[0] 147 const video = videos[0]
146 148
147 await completeVideoCheck(server.url, video, checkAttributes) 149 await completeVideoCheck(server.url, video, checkAttributes)
150 publishedAt = video.publishedAt
148 } 151 }
149 }) 152 })
150 153
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 46fa5f79d..746b5ca6b 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -447,6 +447,7 @@ async function completeVideoCheck (
447 nsfw: boolean 447 nsfw: boolean
448 commentsEnabled: boolean 448 commentsEnabled: boolean
449 description: string 449 description: string
450 publishedAt?: string
450 support: string 451 support: string
451 account: { 452 account: {
452 name: string 453 name: string
@@ -500,6 +501,12 @@ async function completeVideoCheck (
500 expect(dateIsValid(video.publishedAt)).to.be.true 501 expect(dateIsValid(video.publishedAt)).to.be.true
501 expect(dateIsValid(video.updatedAt)).to.be.true 502 expect(dateIsValid(video.updatedAt)).to.be.true
502 503
504 if (attributes.publishedAt) {
505 console.log(attributes.publishedAt)
506 console.log(video.publishedAt)
507 expect(video.publishedAt).to.equal(attributes.publishedAt)
508 }
509
503 const res = await getVideo(url, video.uuid) 510 const res = await getVideo(url, video.uuid)
504 const videoDetails: VideoDetails = res.body 511 const videoDetails: VideoDetails = res.body
505 512