Reorder playlists when adding an element

pull/5502/head
Chocobozzz 2022-12-29 10:38:53 +01:00
parent 0daaab0c0e
commit 15beb86660
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 15 additions and 7 deletions

View File

@ -314,6 +314,6 @@ export class VideoMiniatureComponent implements OnInit {
this.cd.markForCheck()
})
this.videoPlaylistService.runPlaylistCheck(this.video.id)
this.videoPlaylistService.runVideoExistsInPlaylistCheck(this.video.id)
}
}

View File

@ -81,7 +81,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
.subscribe(result => {
this.playlistsData = result.data
this.videoPlaylistService.runPlaylistCheck(this.video.id)
this.videoPlaylistService.runVideoExistsInPlaylistCheck(this.video.id)
})
this.videoPlaylistSearchChanged
@ -129,7 +129,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
.subscribe(playlistsResult => {
this.playlistsData = playlistsResult.data
this.videoPlaylistService.runPlaylistCheck(this.video.id)
this.videoPlaylistService.runVideoExistsInPlaylistCheck(this.video.id)
})
}

View File

@ -206,7 +206,15 @@ export class VideoPlaylistService {
stopTimestamp: body.stopTimestamp
})
this.runPlaylistCheck(body.videoId)
this.runVideoExistsInPlaylistCheck(body.videoId)
if (this.myAccountPlaylistCache) {
const playlist = this.myAccountPlaylistCache.data.find(p => p.id === playlistId)
if (!playlist) return
const otherPlaylists = this.myAccountPlaylistCache.data.filter(p => p !== playlist)
this.myAccountPlaylistCache.data = [ playlist, ...otherPlaylists ]
}
}),
catchError(err => this.restExtractor.handleError(err))
)
@ -225,7 +233,7 @@ export class VideoPlaylistService {
elem.stopTimestamp = body.stopTimestamp
}
this.runPlaylistCheck(videoId)
this.runVideoExistsInPlaylistCheck(videoId)
}),
catchError(err => this.restExtractor.handleError(err))
)
@ -242,7 +250,7 @@ export class VideoPlaylistService {
.filter(e => e.playlistElementId !== playlistElementId)
}
this.runPlaylistCheck(videoId)
this.runVideoExistsInPlaylistCheck(videoId)
}),
catchError(err => this.restExtractor.handleError(err))
)
@ -296,7 +304,7 @@ export class VideoPlaylistService {
return obs
}
runPlaylistCheck (videoId: number) {
runVideoExistsInPlaylistCheck (videoId: number) {
debugLogger('Running playlist check.')
if (this.videoExistsCache[videoId]) {