Reorder playlists when adding an element
This commit is contained in:
parent
0daaab0c0e
commit
15beb86660
|
@ -314,6 +314,6 @@ export class VideoMiniatureComponent implements OnInit {
|
||||||
this.cd.markForCheck()
|
this.cd.markForCheck()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.videoPlaylistService.runPlaylistCheck(this.video.id)
|
this.videoPlaylistService.runVideoExistsInPlaylistCheck(this.video.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
|
||||||
.subscribe(result => {
|
.subscribe(result => {
|
||||||
this.playlistsData = result.data
|
this.playlistsData = result.data
|
||||||
|
|
||||||
this.videoPlaylistService.runPlaylistCheck(this.video.id)
|
this.videoPlaylistService.runVideoExistsInPlaylistCheck(this.video.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.videoPlaylistSearchChanged
|
this.videoPlaylistSearchChanged
|
||||||
|
@ -129,7 +129,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
|
||||||
.subscribe(playlistsResult => {
|
.subscribe(playlistsResult => {
|
||||||
this.playlistsData = playlistsResult.data
|
this.playlistsData = playlistsResult.data
|
||||||
|
|
||||||
this.videoPlaylistService.runPlaylistCheck(this.video.id)
|
this.videoPlaylistService.runVideoExistsInPlaylistCheck(this.video.id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,15 @@ export class VideoPlaylistService {
|
||||||
stopTimestamp: body.stopTimestamp
|
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))
|
catchError(err => this.restExtractor.handleError(err))
|
||||||
)
|
)
|
||||||
|
@ -225,7 +233,7 @@ export class VideoPlaylistService {
|
||||||
elem.stopTimestamp = body.stopTimestamp
|
elem.stopTimestamp = body.stopTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runPlaylistCheck(videoId)
|
this.runVideoExistsInPlaylistCheck(videoId)
|
||||||
}),
|
}),
|
||||||
catchError(err => this.restExtractor.handleError(err))
|
catchError(err => this.restExtractor.handleError(err))
|
||||||
)
|
)
|
||||||
|
@ -242,7 +250,7 @@ export class VideoPlaylistService {
|
||||||
.filter(e => e.playlistElementId !== playlistElementId)
|
.filter(e => e.playlistElementId !== playlistElementId)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runPlaylistCheck(videoId)
|
this.runVideoExistsInPlaylistCheck(videoId)
|
||||||
}),
|
}),
|
||||||
catchError(err => this.restExtractor.handleError(err))
|
catchError(err => this.restExtractor.handleError(err))
|
||||||
)
|
)
|
||||||
|
@ -296,7 +304,7 @@ export class VideoPlaylistService {
|
||||||
return obs
|
return obs
|
||||||
}
|
}
|
||||||
|
|
||||||
runPlaylistCheck (videoId: number) {
|
runVideoExistsInPlaylistCheck (videoId: number) {
|
||||||
debugLogger('Running playlist check.')
|
debugLogger('Running playlist check.')
|
||||||
|
|
||||||
if (this.videoExistsCache[videoId]) {
|
if (this.videoExistsCache[videoId]) {
|
||||||
|
|
Loading…
Reference in New Issue