From d4c9f45b31eda0b7a391ddc83eb290ca5cba311f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 6 Mar 2019 11:32:53 +0100 Subject: Add server migrations --- server/controllers/api/video-playlist.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 2700e8dc7..145764d35 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts @@ -13,7 +13,7 @@ import { import { VideoChannelModel } from '../../models/video/video-channel' import { videoPlaylistsSortValidator } from '../../middlewares/validators' import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' -import { CONFIG, MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE } from '../../initializers' +import { CONFIG, MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers' import { logger } from '../../helpers/logger' import { resetSequelizeInstance } from '../../helpers/database-utils' import { VideoPlaylistModel } from '../../models/video/video-playlist' @@ -46,6 +46,8 @@ const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIM const videoPlaylistRouter = express.Router() +videoPlaylistRouter.get('/privacies', listVideoPlaylistPrivacies) + videoPlaylistRouter.get('/', paginationValidator, videoPlaylistsSortValidator, @@ -121,6 +123,10 @@ export { // --------------------------------------------------------------------------- +function listVideoPlaylistPrivacies (req: express.Request, res: express.Response) { + res.json(VIDEO_PLAYLIST_PRIVACIES) +} + async function listVideoPlaylists (req: express.Request, res: express.Response) { const serverActor = await getServerActor() const resultList = await VideoPlaylistModel.listForApi({ @@ -153,7 +159,7 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) { videoPlaylist.url = getVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object - if (videoPlaylistInfo.videoChannelId !== undefined) { + if (videoPlaylistInfo.videoChannelId) { const videoChannel = res.locals.videoChannel as VideoChannelModel videoPlaylist.videoChannelId = videoChannel.id -- cgit v1.2.3