aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/migrator.ts2
-rw-r--r--server/tests/api/users/user-subscriptions.ts55
-rw-r--r--server/tools/peertube-import-videos.ts3
3 files changed, 47 insertions, 13 deletions
diff --git a/server/initializers/migrator.ts b/server/initializers/migrator.ts
index 7d7c9f8cb..7ac20127e 100644
--- a/server/initializers/migrator.ts
+++ b/server/initializers/migrator.ts
@@ -65,7 +65,7 @@ async function getMigrationScripts () {
65 }[] = [] 65 }[] = []
66 66
67 files 67 files
68 .filter(file => file.endsWith('.js.map') === false) 68 .filter(file => file.endsWith('.js'))
69 .forEach(file => { 69 .forEach(file => {
70 // Filename is something like 'version-blabla.js' 70 // Filename is something like 'version-blabla.js'
71 const version = file.split('-')[0] 71 const version = file.split('-')[0]
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 190a19c38..57cca6ad4 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -2,6 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { VideoPrivacy } from '@shared/models'
5import { 6import {
6 cleanupTests, 7 cleanupTests,
7 createMultipleServers, 8 createMultipleServers,
@@ -32,20 +33,18 @@ describe('Test users subscriptions', function () {
32 // Server 1 and server 2 follow each other 33 // Server 1 and server 2 follow each other
33 await doubleFollow(servers[0], servers[1]) 34 await doubleFollow(servers[0], servers[1])
34 35
35 { 36 for (const server of servers) {
36 for (const server of servers) { 37 const user = { username: 'user' + server.serverNumber, password: 'password' }
37 const user = { username: 'user' + server.serverNumber, password: 'password' } 38 await server.users.create({ username: user.username, password: user.password })
38 await server.users.create({ username: user.username, password: user.password })
39 39
40 const accessToken = await server.login.getAccessToken(user) 40 const accessToken = await server.login.getAccessToken(user)
41 users.push({ accessToken }) 41 users.push({ accessToken })
42 42
43 const videoName1 = 'video 1-' + server.serverNumber 43 const videoName1 = 'video 1-' + server.serverNumber
44 await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } }) 44 await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } })
45 45
46 const videoName2 = 'video 2-' + server.serverNumber 46 const videoName2 = 'video 2-' + server.serverNumber
47 await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } }) 47 await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } })
48 }
49 } 48 }
50 49
51 await waitJobs(servers) 50 await waitJobs(servers)
@@ -540,6 +539,40 @@ describe('Test users subscriptions', function () {
540 } 539 }
541 }) 540 })
542 541
542 it('Should update video as internal and not see from remote server', async function () {
543 this.timeout(30000)
544
545 await servers[2].videos.update({ id: video3UUID, attributes: { name: 'internal', privacy: VideoPrivacy.INTERNAL } })
546 await waitJobs(servers)
547
548 {
549 const { data } = await command.listVideos({ token: users[0].accessToken })
550 expect(data.find(v => v.name === 'internal')).to.not.exist
551 }
552 })
553
554 it('Should see internal from local user', async function () {
555 const { data } = await servers[2].subscriptions.listVideos({ token: servers[2].accessToken })
556 expect(data.find(v => v.name === 'internal')).to.exist
557 })
558
559 it('Should update video as private and not see from anyone server', async function () {
560 this.timeout(30000)
561
562 await servers[2].videos.update({ id: video3UUID, attributes: { name: 'private', privacy: VideoPrivacy.PRIVATE } })
563 await waitJobs(servers)
564
565 {
566 const { data } = await command.listVideos({ token: users[0].accessToken })
567 expect(data.find(v => v.name === 'private')).to.not.exist
568 }
569
570 {
571 const { data } = await servers[2].subscriptions.listVideos({ token: servers[2].accessToken })
572 expect(data.find(v => v.name === 'private')).to.not.exist
573 }
574 })
575
543 after(async function () { 576 after(async function () {
544 await cleanupTests(servers) 577 await cleanupTests(servers)
545 }) 578 })
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 44c42bad6..87aec60ef 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -5,7 +5,8 @@ import { program } from 'commander'
5import { accessSync, constants } from 'fs' 5import { accessSync, constants } from 'fs'
6import { remove } from 'fs-extra' 6import { remove } from 'fs-extra'
7import { join } from 'path' 7import { join } from 'path'
8import { sha256, wait } from '@shared/core-utils' 8import { sha256 } from '@shared/extra-utils'
9import { wait } from '@shared/core-utils'
9import { doRequestAndSaveToFile } from '../helpers/requests' 10import { doRequestAndSaveToFile } from '../helpers/requests'
10import { 11import {
11 assignToken, 12 assignToken,