From b767c4a74aa5ce44c7b6a89962cb153ecb3ace07 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 17 May 2019 14:52:44 +0200 Subject: [PATCH] Fix reordering playlist --- .../my-account-video-playlist-elements.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts index 25d51d2cb..03f34412c 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts @@ -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(