aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorFlorian CUNY <poslovitch@bentobox.world>2021-04-26 11:01:29 +0200
committerGitHub <noreply@github.com>2021-04-26 11:01:29 +0200
commite771e82dfac5f8cd5462fecf6618f9b1fb314e30 (patch)
tree6abf1789ad2603ad975c31b9a513ad60b8fde8d7 /client/src/app/+videos/+video-watch/video-watch.component.ts
parentfd78d2e247b014fd1561cfb5206c9b8b14d6b820 (diff)
downloadPeerTube-e771e82dfac5f8cd5462fecf6618f9b1fb314e30.tar.gz
PeerTube-e771e82dfac5f8cd5462fecf6618f9b1fb314e30.tar.zst
PeerTube-e771e82dfac5f8cd5462fecf6618f9b1fb314e30.zip
Added "last" and a reversed ?playlistPosition in playlist URL (#3974)
* Added "last" and a reversed playlistPosition Implements https://github.com/Chocobozzz/PeerTube/issues/3897 * Fixed lint errors in video-watch component * Applied requested changes * Removed debug logs * Fixed lint * Playlist position styling Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'client/src/app/+videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 5530dc8ad..107826824 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -188,7 +188,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
188 }) 188 })
189 189
190 this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { 190 this.queryParamsSub = this.route.queryParams.subscribe(queryParams => {
191 this.playlistPosition = queryParams[ 'playlistPosition' ] 191 // Handle the ?playlistPosition
192 const positionParam = queryParams[ 'playlistPosition' ]
193
194 this.playlistPosition = positionParam === 'last'
195 ? -1 // Handle the "last" index
196 : parseInt(positionParam, 10)
197
198 if (isNaN(this.playlistPosition)) {
199 console.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`)
200 this.playlistPosition = 1
201 }
202
192 this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) 203 this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition)
193 204
194 const start = queryParams[ 'start' ] 205 const start = queryParams[ 'start' ]