]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix reordering playlist
authorChocobozzz <me@florianbigard.com>
Fri, 17 May 2019 12:52:44 +0000 (14:52 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 17 May 2019 12:52:44 +0000 (14:52 +0200)
client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts

index 25d51d2cbdb5de89f0201ae0ff7c982048872c1c..03f34412cabdd6e372104589278211cc79874105 100644 (file)
@@ -67,7 +67,9 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro
     if (previousIndex === newIndex) return
 
     const oldPosition = this.videos[previousIndex].playlistElement.position
-    const insertAfter = newIndex === 0 ? 0 : this.videos[newIndex].playlistElement.position
+    let insertAfter = this.videos[newIndex].playlistElement.position
+
+    if (oldPosition > insertAfter) insertAfter--
 
     this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
       .subscribe(