From 8a19bee1a1ee39f973bb37429e4f73c3f2873cdb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 17 Aug 2018 15:45:42 +0200 Subject: Add ability to set a name to a channel --- server/controllers/api/accounts.ts | 2 +- server/controllers/api/video-channel.ts | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 308970abc..7b7e5e740 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -78,7 +78,7 @@ async function listAccountVideos (req: express.Request, res: express.Response, n start: req.query.start, count: req.query.count, sort: req.query.sort, - includeLocalVideos: false, + includeLocalVideos: true, categoryOneOf: req.query.categoryOneOf, licenceOneOf: req.query.licenceOneOf, languageOneOf: req.query.languageOneOf, diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 6ffc09f87..3f51f03f4 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -10,13 +10,12 @@ import { setDefaultPagination, setDefaultSort, videoChannelsAddValidator, - videoChannelsGetValidator, videoChannelsRemoveValidator, videoChannelsSortValidator, videoChannelsUpdateValidator } from '../../middlewares' import { VideoChannelModel } from '../../models/video/video-channel' -import { videosSortValidator } from '../../middlewares/validators' +import { videoChannelsNameWithHostValidator, videosSortValidator } from '../../middlewares/validators' import { sendUpdateActor } from '../../lib/activitypub/send' import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' import { createVideoChannel } from '../../lib/video-channel' @@ -50,7 +49,7 @@ videoChannelRouter.post('/', asyncRetryTransactionMiddleware(addVideoChannel) ) -videoChannelRouter.post('/:id/avatar/pick', +videoChannelRouter.post('/:nameWithHost/avatar/pick', authenticate, reqAvatarFile, // Check the rights @@ -59,25 +58,25 @@ videoChannelRouter.post('/:id/avatar/pick', asyncMiddleware(updateVideoChannelAvatar) ) -videoChannelRouter.put('/:id', +videoChannelRouter.put('/:nameWithHost', authenticate, asyncMiddleware(videoChannelsUpdateValidator), asyncRetryTransactionMiddleware(updateVideoChannel) ) -videoChannelRouter.delete('/:id', +videoChannelRouter.delete('/:nameWithHost', authenticate, asyncMiddleware(videoChannelsRemoveValidator), asyncRetryTransactionMiddleware(removeVideoChannel) ) -videoChannelRouter.get('/:id', - asyncMiddleware(videoChannelsGetValidator), +videoChannelRouter.get('/:nameWithHost', + asyncMiddleware(videoChannelsNameWithHostValidator), asyncMiddleware(getVideoChannel) ) -videoChannelRouter.get('/:id/videos', - asyncMiddleware(videoChannelsGetValidator), +videoChannelRouter.get('/:nameWithHost/videos', + asyncMiddleware(videoChannelsNameWithHostValidator), paginationValidator, videosSortValidator, setDefaultSort, @@ -215,7 +214,7 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon start: req.query.start, count: req.query.count, sort: req.query.sort, - includeLocalVideos: false, + includeLocalVideos: true, categoryOneOf: req.query.categoryOneOf, licenceOneOf: req.query.licenceOneOf, languageOneOf: req.query.languageOneOf, -- cgit v1.2.3