Merge branch '1190-shuffle' into 'develop'
Fix #1190: improved shuffle behaviour Closes #1190 See merge request funkwhale/funkwhale!1202
This commit is contained in:
commit
d18b02c2d2
|
@ -0,0 +1 @@
|
|||
Improved shuffle behaviour (#1190)
|
|
@ -158,16 +158,15 @@ export default {
|
|||
// so we replay automatically on next track append
|
||||
commit('ended', true)
|
||||
},
|
||||
shuffle ({dispatch, commit, state}, callback) {
|
||||
let toKeep = state.tracks.slice(0, state.currentIndex + 1)
|
||||
let toShuffle = state.tracks.slice(state.currentIndex + 1)
|
||||
let shuffled = toKeep.concat(_.shuffle(toShuffle))
|
||||
async shuffle ({dispatch, commit, state}, callback) {
|
||||
let shuffled = _.shuffle(state.tracks)
|
||||
commit('tracks', [])
|
||||
let params = {tracks: shuffled}
|
||||
if (callback) {
|
||||
params.callback = callback
|
||||
}
|
||||
dispatch('appendMany', params)
|
||||
await dispatch('appendMany', params)
|
||||
await dispatch('currentIndex', 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue