diff --git a/front/src/components/audio/Player.vue b/front/src/components/audio/Player.vue index 75a01c52e..2b0032cf7 100644 --- a/front/src/components/audio/Player.vue +++ b/front/src/components/audio/Player.vue @@ -58,9 +58,8 @@
- + class="two wide column control"> +
{ return state.currentIndex < state.tracks.length - 1 - }, - hasPrevious: state => { - return state.currentIndex > 0 } }, actions: { @@ -103,9 +100,11 @@ export default { dispatch('next') } }, - previous ({state, dispatch}) { - if (state.currentIndex > 0) { + previous ({state, dispatch, rootState}) { + if (state.currentIndex > 0 && rootState.player.currentTime < 3) { dispatch('currentIndex', state.currentIndex - 1) + } else { + dispatch('currentIndex', state.currentIndex) } }, next ({state, dispatch, commit, rootState}) { diff --git a/front/test/unit/specs/store/queue.spec.js b/front/test/unit/specs/store/queue.spec.js index b445229ec..a46ca35bf 100644 --- a/front/test/unit/specs/store/queue.spec.js +++ b/front/test/unit/specs/store/queue.spec.js @@ -81,14 +81,6 @@ describe('store/queue', () => { const state = { tracks: [1, 2, 3], currentIndex: 2 } expect(store.getters['hasNext'](state)).to.equal(false) }) - it('hasPrevious true', () => { - const state = { currentIndex: 1 } - expect(store.getters['hasPrevious'](state)).to.equal(true) - }) - it('hasPrevious false', () => { - const state = { currentIndex: 0 } - expect(store.getters['hasPrevious'](state)).to.equal(false) - }) }) describe('actions', () => { it('append at end', (done) => {