aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/video-playlist.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts
index 709c58beb..e026b4d16 100644
--- a/server/controllers/api/video-playlist.ts
+++ b/server/controllers/api/video-playlist.ts
@@ -4,7 +4,7 @@ import {
4 asyncMiddleware, 4 asyncMiddleware,
5 asyncRetryTransactionMiddleware, 5 asyncRetryTransactionMiddleware,
6 authenticate, 6 authenticate,
7 commonVideosFiltersValidator, 7 commonVideosFiltersValidator, optionalAuthenticate,
8 paginationValidator, 8 paginationValidator,
9 setDefaultPagination, 9 setDefaultPagination,
10 setDefaultSort 10 setDefaultSort
@@ -31,12 +31,14 @@ import { processImage } from '../../helpers/image-utils'
31import { join } from 'path' 31import { join } from 'path'
32import { UserModel } from '../../models/account/user' 32import { UserModel } from '../../models/account/user'
33import { 33import {
34 getVideoPlaylistActivityPubUrl,
35 getVideoPlaylistElementActivityPubUrl,
36 sendCreateVideoPlaylist, 34 sendCreateVideoPlaylist,
37 sendDeleteVideoPlaylist, 35 sendDeleteVideoPlaylist,
38 sendUpdateVideoPlaylist 36 sendUpdateVideoPlaylist
39} from '../../lib/activitypub' 37} from '../../lib/activitypub/send'
38import {
39 getVideoPlaylistActivityPubUrl,
40 getVideoPlaylistElementActivityPubUrl
41} from '../../lib/activitypub/url'
40import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model' 42import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model'
41import { VideoModel } from '../../models/video/video' 43import { VideoModel } from '../../models/video/video'
42import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' 44import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element'
@@ -85,6 +87,7 @@ videoPlaylistRouter.get('/:playlistId/videos',
85 asyncMiddleware(videoPlaylistsGetValidator), 87 asyncMiddleware(videoPlaylistsGetValidator),
86 paginationValidator, 88 paginationValidator,
87 setDefaultPagination, 89 setDefaultPagination,
90 optionalAuthenticate,
88 commonVideosFiltersValidator, 91 commonVideosFiltersValidator,
89 asyncMiddleware(getVideoPlaylistVideos) 92 asyncMiddleware(getVideoPlaylistVideos)
90) 93)
@@ -95,7 +98,7 @@ videoPlaylistRouter.post('/:playlistId/videos',
95 asyncRetryTransactionMiddleware(addVideoInPlaylist) 98 asyncRetryTransactionMiddleware(addVideoInPlaylist)
96) 99)
97 100
98videoPlaylistRouter.put('/:playlistId/videos', 101videoPlaylistRouter.post('/:playlistId/videos/reorder',
99 authenticate, 102 authenticate,
100 asyncMiddleware(videoPlaylistsReorderVideosValidator), 103 asyncMiddleware(videoPlaylistsReorderVideosValidator),
101 asyncRetryTransactionMiddleware(reorderVideosPlaylist) 104 asyncRetryTransactionMiddleware(reorderVideosPlaylist)
@@ -168,6 +171,7 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) {
168 const videoPlaylistCreated: VideoPlaylistModel = await sequelizeTypescript.transaction(async t => { 171 const videoPlaylistCreated: VideoPlaylistModel = await sequelizeTypescript.transaction(async t => {
169 const videoPlaylistCreated = await videoPlaylist.save({ transaction: t }) 172 const videoPlaylistCreated = await videoPlaylist.save({ transaction: t })
170 173
174 videoPlaylistCreated.OwnerAccount = user.Account
171 await sendCreateVideoPlaylist(videoPlaylistCreated, t) 175 await sendCreateVideoPlaylist(videoPlaylistCreated, t)
172 176
173 return videoPlaylistCreated 177 return videoPlaylistCreated
@@ -349,7 +353,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons
349 const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist 353 const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
350 354
351 const start: number = req.body.startPosition 355 const start: number = req.body.startPosition
352 const insertAfter: number = req.body.insertAfter 356 const insertAfter: number = req.body.insertAfterPosition
353 const reorderLength: number = req.body.reorderLength || 1 357 const reorderLength: number = req.body.reorderLength || 1
354 358
355 if (start === insertAfter) { 359 if (start === insertAfter) {