diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/video-playlist.ts | 16 |
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' | |||
31 | import { join } from 'path' | 31 | import { join } from 'path' |
32 | import { UserModel } from '../../models/account/user' | 32 | import { UserModel } from '../../models/account/user' |
33 | import { | 33 | import { |
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' |
38 | import { | ||
39 | getVideoPlaylistActivityPubUrl, | ||
40 | getVideoPlaylistElementActivityPubUrl | ||
41 | } from '../../lib/activitypub/url' | ||
40 | import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model' | 42 | import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model' |
41 | import { VideoModel } from '../../models/video/video' | 43 | import { VideoModel } from '../../models/video/video' |
42 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' | 44 | import { 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 | ||
98 | videoPlaylistRouter.put('/:playlistId/videos', | 101 | videoPlaylistRouter.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) { |