diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-17 16:39:32 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-19 11:30:21 +0200 |
commit | 371906639ee9b6ea4daae504bc7c2b15856c3f38 (patch) | |
tree | a1807d7e5648a8b99565cc22daa22a1afbb34db4 /server/controllers | |
parent | b75410b87d889ae5b1704cc7f9d32a3792db9075 (diff) | |
download | PeerTube-371906639ee9b6ea4daae504bc7c2b15856c3f38.tar.gz PeerTube-371906639ee9b6ea4daae504bc7c2b15856c3f38.tar.zst PeerTube-371906639ee9b6ea4daae504bc7c2b15856c3f38.zip |
Add ability to a video multiple times in a playlist
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/video-playlist.ts | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index acce53713..1da44d096 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -159,7 +159,7 @@ activityPubClientRouter.get('/video-playlists/:playlistId', | |||
159 | asyncMiddleware(videoPlaylistsGetValidator('all')), | 159 | asyncMiddleware(videoPlaylistsGetValidator('all')), |
160 | asyncMiddleware(videoPlaylistController) | 160 | asyncMiddleware(videoPlaylistController) |
161 | ) | 161 | ) |
162 | activityPubClientRouter.get('/video-playlists/:playlistId/:videoId', | 162 | activityPubClientRouter.get('/video-playlists/:playlistId/videos/:playlistElementId', |
163 | executeIfActivityPub, | 163 | executeIfActivityPub, |
164 | asyncMiddleware(videoPlaylistElementAPGetValidator), | 164 | asyncMiddleware(videoPlaylistElementAPGetValidator), |
165 | videoPlaylistElementController | 165 | videoPlaylistElementController |
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 88a2314fb..41a0e07ff 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -297,7 +297,6 @@ async function addVideoInPlaylist (req: express.Request, res: express.Response) | |||
297 | const position = await VideoPlaylistElementModel.getNextPositionOf(videoPlaylist.id, t) | 297 | const position = await VideoPlaylistElementModel.getNextPositionOf(videoPlaylist.id, t) |
298 | 298 | ||
299 | const playlistElement = await VideoPlaylistElementModel.create({ | 299 | const playlistElement = await VideoPlaylistElementModel.create({ |
300 | url: getVideoPlaylistElementActivityPubUrl(videoPlaylist, video), | ||
301 | position, | 300 | position, |
302 | startTimestamp: body.startTimestamp || null, | 301 | startTimestamp: body.startTimestamp || null, |
303 | stopTimestamp: body.stopTimestamp || null, | 302 | stopTimestamp: body.stopTimestamp || null, |
@@ -305,6 +304,9 @@ async function addVideoInPlaylist (req: express.Request, res: express.Response) | |||
305 | videoId: video.id | 304 | videoId: video.id |
306 | }, { transaction: t }) | 305 | }, { transaction: t }) |
307 | 306 | ||
307 | playlistElement.url = getVideoPlaylistElementActivityPubUrl(videoPlaylist, playlistElement) | ||
308 | await playlistElement.save({ transaction: t }) | ||
309 | |||
308 | videoPlaylist.changed('updatedAt', true) | 310 | videoPlaylist.changed('updatedAt', true) |
309 | await videoPlaylist.save({ transaction: t }) | 311 | await videoPlaylist.save({ transaction: t }) |
310 | 312 | ||