Skip to content
Snippets Groups Projects
Commit af883242 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch '151-queue-delete' into 'develop'

Resolve "Reordering the queue do not honor currently playing track"

Closes #151

See merge request funkwhale/funkwhale!158
parents 48c9a8bd 6ed6634f
No related branches found
No related tags found
No related merge requests found
Fixed queue reorder or track deletion restarting currently playing track (#151)
......@@ -143,8 +143,9 @@ export default {
...mapActions({
cleanTrack: 'queue/cleanTrack'
}),
reorder: function (oldValue, newValue) {
this.$store.commit('queue/reorder', {oldValue, newValue})
reorder: function (event) {
this.$store.commit('queue/reorder', {
oldIndex: event.oldIndex, newIndex: event.newIndex})
},
scrollToCurrent () {
let current = $(this.$el).find('[data-tab="queue"] .active')[0]
......
......@@ -4,7 +4,7 @@
<audio-track
ref="currentAudio"
v-if="renderAudio && currentTrack"
:key="(currentIndex, currentTrack.id)"
:key="currentTrack.id"
:is-current="true"
:start-time="$store.state.player.currentTime"
:autoplay="$store.state.player.playing"
......
......@@ -86,9 +86,15 @@ export default {
}
},
updateDuration: function (e) {
if (!this.$refs.audio) {
return
}
this.$store.commit('player/duration', this.$refs.audio.duration)
},
loaded: function () {
if (!this.$refs.audio) {
return
}
this.$refs.audio.volume = this.volume
this.$store.commit('player/resetErrorCount')
if (this.isCurrent) {
......
......@@ -92,10 +92,10 @@ export default {
if (current) {
dispatch('player/stop', null, {root: true})
}
commit('splice', {start: index, size: 1})
if (index < state.currentIndex) {
dispatch('currentIndex', state.currentIndex - 1)
commit('currentIndex', state.currentIndex - 1)
}
commit('splice', {start: index, size: 1})
if (current) {
// we play next track, which now have the same index
dispatch('currentIndex', index)
......
......@@ -158,9 +158,7 @@ describe('store/queue', () => {
payload: 1,
params: {state: {currentIndex: 2}},
expectedMutations: [
{ type: 'splice', payload: {start: 1, size: 1} }
],
expectedActions: [
{ type: 'splice', payload: {start: 1, size: 1} },
{ type: 'currentIndex', payload: 1 }
]
}, done)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment