aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2021-12-13 15:29:13 +0100
committerGitHub <noreply@github.com>2021-12-13 15:29:13 +0100
commita37e9e74ff07b057370d1ed6c0b391a02be8a6d2 (patch)
tree30d59e12518149a309bbd10bee1485f8be523c75 /server/tests/api
parent11e520b50d791a0dd48cbb2d0fc681b25eb7cd53 (diff)
downloadPeerTube-a37e9e74ff07b057370d1ed6c0b391a02be8a6d2.tar.gz
PeerTube-a37e9e74ff07b057370d1ed6c0b391a02be8a6d2.tar.zst
PeerTube-a37e9e74ff07b057370d1ed6c0b391a02be8a6d2.zip
Give moderators access to edit channels (#4608)
* give admins access to edit all channels closes #4598 * test(channels): +admin update another users channel * Fix tests * fix(server): delete another users channel Since the channel owner isn't necessary the auth user we need to check the right account whether it's the last video or not. * REMOVE_ANY_VIDEO_CHANNEL > MANAGE_ANY_VIDEO_CHANNEL Merge REMOVE_ANY_VIDEO_CHANNEL and MANY_VIDEO_CHANNELS to MANAGE_ANY_VIDEO_CHANNEL. * user-right: moderator can't manage admins channel * client: MyVideoChannelCreateComponent > VideoChannelCreateComponent * client: MyVideoChannelEdit > VideoChannelEdit * Revert "user-right: moderator can't manage admins channel" This reverts commit 2c627c154e2bfe6af2e0f45efb27faf4117572f3. * server: clean dupl validator functionality * fix ensureUserCanManageChannel usage It's not async anymore. * server: merge channel validator middleares ensureAuthUserOwnsChannelValidator & ensureUserCanManageChannel gets merged into one middleware. * client(VideoChannelEdit): redirect to prev route * fix(VideoChannels): handle anon users * client: new routes for create/update channel * Refactor channel validators Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/videos/video-channels.ts37
1 files changed, 34 insertions, 3 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index c25754eb6..6ab5faa07 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -33,6 +33,7 @@ describe('Test video channels', function () {
33 let totoChannel: number 33 let totoChannel: number
34 let videoUUID: string 34 let videoUUID: string
35 let accountName: string 35 let accountName: string
36 let secondUserChannelName: string
36 37
37 const avatarPaths: { [ port: number ]: string } = {} 38 const avatarPaths: { [ port: number ]: string } = {}
38 const bannerPaths: { [ port: number ]: string } = {} 39 const bannerPaths: { [ port: number ]: string } = {}
@@ -219,6 +220,35 @@ describe('Test video channels', function () {
219 } 220 }
220 }) 221 })
221 222
223 it('Should update another accounts video channel', async function () {
224 this.timeout(15000)
225
226 const result = await servers[0].users.generate('second_user')
227 secondUserChannelName = result.userChannelName
228
229 await servers[0].videos.quickUpload({ name: 'video', token: result.token })
230
231 const videoChannelAttributes = {
232 displayName: 'video channel updated',
233 description: 'video channel description updated',
234 support: 'support updated'
235 }
236
237 await servers[0].channels.update({ channelName: secondUserChannelName, attributes: videoChannelAttributes })
238
239 await waitJobs(servers)
240 })
241
242 it('Should have another accounts video channel updated', async function () {
243 for (const server of servers) {
244 const body = await server.channels.get({ channelName: `${secondUserChannelName}@${servers[0].host}` })
245
246 expect(body.displayName).to.equal('video channel updated')
247 expect(body.description).to.equal('video channel description updated')
248 expect(body.support).to.equal('support updated')
249 }
250 })
251
222 it('Should update the channel support field and update videos too', async function () { 252 it('Should update the channel support field and update videos too', async function () {
223 this.timeout(35000) 253 this.timeout(35000)
224 254
@@ -368,12 +398,13 @@ describe('Test video channels', function () {
368 }) 398 })
369 399
370 it('Should have video channel deleted', async function () { 400 it('Should have video channel deleted', async function () {
371 const body = await servers[0].channels.list({ start: 0, count: 10 }) 401 const body = await servers[0].channels.list({ start: 0, count: 10, sort: 'createdAt' })
372 402
373 expect(body.total).to.equal(1) 403 expect(body.total).to.equal(2)
374 expect(body.data).to.be.an('array') 404 expect(body.data).to.be.an('array')
375 expect(body.data).to.have.lengthOf(1) 405 expect(body.data).to.have.lengthOf(2)
376 expect(body.data[0].displayName).to.equal('Main root channel') 406 expect(body.data[0].displayName).to.equal('Main root channel')
407 expect(body.data[1].displayName).to.equal('video channel updated')
377 }) 408 })
378 409
379 it('Should create the main channel with an uuid if there is a conflict', async function () { 410 it('Should create the main channel with an uuid if there is a conflict', async function () {