aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/video-channel.ts2
-rw-r--r--server/lib/user.ts4
-rw-r--r--server/lib/video-channel.ts2
-rw-r--r--server/middlewares/validators/video-channels.ts4
-rw-r--r--server/tests/api/check-params/video-channels.ts14
-rw-r--r--server/tests/api/videos/multiple-servers.ts2
-rw-r--r--server/tests/api/videos/video-channels.ts4
-rw-r--r--server/tests/utils/videos/video-channels.ts15
8 files changed, 21 insertions, 26 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 6241aaa5c..263eb2a8a 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -138,7 +138,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response)
138 transaction: t 138 transaction: t
139 } 139 }
140 140
141 if (videoChannelInfoToUpdate.name !== undefined) videoChannelInstance.set('name', videoChannelInfoToUpdate.name) 141 if (videoChannelInfoToUpdate.displayName !== undefined) videoChannelInstance.set('name', videoChannelInfoToUpdate.displayName)
142 if (videoChannelInfoToUpdate.description !== undefined) videoChannelInstance.set('description', videoChannelInfoToUpdate.description) 142 if (videoChannelInfoToUpdate.description !== undefined) videoChannelInstance.set('description', videoChannelInfoToUpdate.description)
143 if (videoChannelInfoToUpdate.support !== undefined) videoChannelInstance.set('support', videoChannelInfoToUpdate.support) 143 if (videoChannelInfoToUpdate.support !== undefined) videoChannelInstance.set('support', videoChannelInfoToUpdate.support)
144 144
diff --git a/server/lib/user.ts b/server/lib/user.ts
index d019c4e71..51050de9b 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -17,9 +17,9 @@ async function createUserAccountAndChannel (userToCreate: UserModel, validateUse
17 const userCreated = await userToCreate.save(userOptions) 17 const userCreated = await userToCreate.save(userOptions)
18 const accountCreated = await createLocalAccountWithoutKeys(userToCreate.username, userToCreate.id, null, t) 18 const accountCreated = await createLocalAccountWithoutKeys(userToCreate.username, userToCreate.id, null, t)
19 19
20 const videoChannelName = `Default ${userCreated.username} channel` 20 const videoChannelDisplayName = `Default ${userCreated.username} channel`
21 const videoChannelInfo = { 21 const videoChannelInfo = {
22 name: videoChannelName 22 displayName: videoChannelDisplayName
23 } 23 }
24 const videoChannel = await createVideoChannel(videoChannelInfo, accountCreated, t) 24 const videoChannel = await createVideoChannel(videoChannelInfo, accountCreated, t)
25 25
diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts
index 9f7ed9297..600316cda 100644
--- a/server/lib/video-channel.ts
+++ b/server/lib/video-channel.ts
@@ -14,7 +14,7 @@ async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account
14 const actorInstanceCreated = await actorInstance.save({ transaction: t }) 14 const actorInstanceCreated = await actorInstance.save({ transaction: t })
15 15
16 const videoChannelData = { 16 const videoChannelData = {
17 name: videoChannelInfo.name, 17 name: videoChannelInfo.displayName,
18 description: videoChannelInfo.description, 18 description: videoChannelInfo.description,
19 support: videoChannelInfo.support, 19 support: videoChannelInfo.support,
20 accountId: account.id, 20 accountId: account.id,
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts
index a70f196df..3af20a1b4 100644
--- a/server/middlewares/validators/video-channels.ts
+++ b/server/middlewares/validators/video-channels.ts
@@ -27,7 +27,7 @@ const listVideoAccountChannelsValidator = [
27] 27]
28 28
29const videoChannelsAddValidator = [ 29const videoChannelsAddValidator = [
30 body('name').custom(isVideoChannelNameValid).withMessage('Should have a valid name'), 30 body('displayName').custom(isVideoChannelNameValid).withMessage('Should have a valid display name'),
31 body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), 31 body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'),
32 body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), 32 body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'),
33 33
@@ -42,7 +42,7 @@ const videoChannelsAddValidator = [
42 42
43const videoChannelsUpdateValidator = [ 43const videoChannelsUpdateValidator = [
44 param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), 44 param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
45 body('name').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid name'), 45 body('displayName').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid display name'),
46 body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'), 46 body('description').optional().custom(isVideoChannelDescriptionValid).withMessage('Should have a valid description'),
47 body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'), 47 body('support').optional().custom(isVideoChannelSupportValid).withMessage('Should have a valid support text'),
48 48
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 7cda879ed..40a8e97cc 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -25,7 +25,7 @@ import { User } from '../../../../shared/models/users'
25 25
26const expect = chai.expect 26const expect = chai.expect
27 27
28describe('Test videos API validator', function () { 28describe('Test video channels API validator', function () {
29 const videoChannelPath = '/api/v1/video-channels' 29 const videoChannelPath = '/api/v1/video-channels'
30 let server: ServerInfo 30 let server: ServerInfo
31 let accessTokenUser: string 31 let accessTokenUser: string
@@ -85,7 +85,7 @@ describe('Test videos API validator', function () {
85 85
86 describe('When adding a video channel', function () { 86 describe('When adding a video channel', function () {
87 const baseCorrectParams = { 87 const baseCorrectParams = {
88 name: 'hello', 88 displayName: 'hello',
89 description: 'super description', 89 description: 'super description',
90 support: 'super support text' 90 support: 'super support text'
91 } 91 }
@@ -105,13 +105,13 @@ describe('Test videos API validator', function () {
105 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 105 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
106 }) 106 })
107 107
108 it('Should fail without name', async function () { 108 it('Should fail without a name', async function () {
109 const fields = omit(baseCorrectParams, 'name') 109 const fields = omit(baseCorrectParams, 'displayName')
110 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 110 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
111 }) 111 })
112 112
113 it('Should fail with a long name', async function () { 113 it('Should fail with a long name', async function () {
114 const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(25) }) 114 const fields = immutableAssign(baseCorrectParams, { displayName: 'super'.repeat(25) })
115 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 115 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
116 }) 116 })
117 117
@@ -138,7 +138,7 @@ describe('Test videos API validator', function () {
138 138
139 describe('When updating a video channel', function () { 139 describe('When updating a video channel', function () {
140 const baseCorrectParams = { 140 const baseCorrectParams = {
141 name: 'hello', 141 displayName: 'hello',
142 description: 'super description' 142 description: 'super description'
143 } 143 }
144 let path: string 144 let path: string
@@ -168,7 +168,7 @@ describe('Test videos API validator', function () {
168 }) 168 })
169 169
170 it('Should fail with a long name', async function () { 170 it('Should fail with a long name', async function () {
171 const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(25) }) 171 const fields = immutableAssign(baseCorrectParams, { displayName: 'super'.repeat(25) })
172 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 172 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
173 }) 173 })
174 174
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index e462a2d47..94d627e26 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -59,7 +59,7 @@ describe('Test multiple servers', function () {
59 59
60 { 60 {
61 const videoChannel = { 61 const videoChannel = {
62 name: 'my channel', 62 displayName: 'my channel',
63 description: 'super channel' 63 description: 'super channel'
64 } 64 }
65 await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, videoChannel) 65 await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, videoChannel)
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index d24b8ab0b..585b6a2b5 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -59,7 +59,7 @@ describe('Test video channels', function () {
59 this.timeout(10000) 59 this.timeout(10000)
60 60
61 const videoChannel = { 61 const videoChannel = {
62 name: 'second video channel', 62 displayName: 'second video channel',
63 description: 'super video channel description', 63 description: 'super video channel description',
64 support: 'super video channel support text' 64 support: 'super video channel support text'
65 } 65 }
@@ -125,7 +125,7 @@ describe('Test video channels', function () {
125 this.timeout(5000) 125 this.timeout(5000)
126 126
127 const videoChannelAttributes = { 127 const videoChannelAttributes = {
128 name: 'video channel updated', 128 displayName: 'video channel updated',
129 description: 'video channel description updated', 129 description: 'video channel description updated',
130 support: 'video channel support text updated' 130 support: 'video channel support text updated'
131 } 131 }
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts
index 978e21b19..021c4c420 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/server/tests/utils/videos/video-channels.ts
@@ -1,10 +1,5 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2 2import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared/models/videos'
3type VideoChannelAttributes = {
4 name?: string
5 description?: string
6 support?: string
7}
8 3
9function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { 4function getVideoChannelsList (url: string, start: number, count: number, sort?: string) {
10 const path = '/api/v1/video-channels' 5 const path = '/api/v1/video-channels'
@@ -34,14 +29,14 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s
34function addVideoChannel ( 29function addVideoChannel (
35 url: string, 30 url: string,
36 token: string, 31 token: string,
37 videoChannelAttributesArg: VideoChannelAttributes, 32 videoChannelAttributesArg: VideoChannelCreate,
38 expectedStatus = 200 33 expectedStatus = 200
39) { 34) {
40 const path = '/api/v1/video-channels/' 35 const path = '/api/v1/video-channels/'
41 36
42 // Default attributes 37 // Default attributes
43 let attributes = { 38 let attributes = {
44 name: 'my super video channel', 39 displayName: 'my super video channel',
45 description: 'my super channel description', 40 description: 'my super channel description',
46 support: 'my super channel support' 41 support: 'my super channel support'
47 } 42 }
@@ -59,13 +54,13 @@ function updateVideoChannel (
59 url: string, 54 url: string,
60 token: string, 55 token: string,
61 channelId: number | string, 56 channelId: number | string,
62 attributes: VideoChannelAttributes, 57 attributes: VideoChannelUpdate,
63 expectedStatus = 204 58 expectedStatus = 204
64) { 59) {
65 const body = {} 60 const body = {}
66 const path = '/api/v1/video-channels/' + channelId 61 const path = '/api/v1/video-channels/' + channelId
67 62
68 if (attributes.name) body['name'] = attributes.name 63 if (attributes.displayName) body['displayName'] = attributes.displayName
69 if (attributes.description) body['description'] = attributes.description 64 if (attributes.description) body['description'] = attributes.description
70 if (attributes.support) body['support'] = attributes.support 65 if (attributes.support) body['support'] = attributes.support
71 66