Merge branch '87-radio-delete' into 'develop'
Fixed #87:Now always load next radio track on last queue track ended Closes #87 See merge request funkwhale/funkwhale!65
This commit is contained in:
commit
16365ded56
|
@ -78,8 +78,15 @@ export default {
|
|||
logger.default.error('Could not record track in history')
|
||||
})
|
||||
},
|
||||
trackEnded ({dispatch}, track) {
|
||||
trackEnded ({dispatch, rootState}, track) {
|
||||
dispatch('trackListened', track)
|
||||
let queueState = rootState.queue
|
||||
if (queueState.currentIndex === queueState.tracks.length - 1) {
|
||||
// we've reached last track of queue, trigger a reload
|
||||
// from radio if any
|
||||
dispatch('radios/populateQueue', null, {root: true})
|
||||
}
|
||||
dispatch('queue/next', null, {root: true})
|
||||
dispatch('queue/next', null, {root: true})
|
||||
},
|
||||
trackErrored ({commit, dispatch}) {
|
||||
|
|
|
@ -122,12 +122,25 @@ describe('store/player', () => {
|
|||
testAction({
|
||||
action: store.actions.trackEnded,
|
||||
payload: {test: 'track'},
|
||||
params: {rootState: {queue: {currentIndex:0, tracks: [1, 2]}}},
|
||||
expectedActions: [
|
||||
{ type: 'trackListened', payload: {test: 'track'} },
|
||||
{ type: 'queue/next', payload: null, options: {root: true} }
|
||||
]
|
||||
}, done)
|
||||
})
|
||||
it('trackEnded calls populateQueue if last', (done) => {
|
||||
testAction({
|
||||
action: store.actions.trackEnded,
|
||||
payload: {test: 'track'},
|
||||
params: {rootState: {queue: {currentIndex:1, tracks: [1, 2]}}},
|
||||
expectedActions: [
|
||||
{ type: 'trackListened', payload: {test: 'track'} },
|
||||
{ type: 'radios/populateQueue', payload: null, options: {root: true} },
|
||||
{ type: 'queue/next', payload: null, options: {root: true} }
|
||||
]
|
||||
}, done)
|
||||
})
|
||||
it('trackErrored', (done) => {
|
||||
testAction({
|
||||
action: store.actions.trackErrored,
|
||||
|
|
Loading…
Reference in New Issue