Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Walko
funkwhale
Commits
7df783a7
Verified
Commit
7df783a7
authored
6 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Fix #281: broken "play all" button that played only 25 tracks
parent
a16bd2a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/changelog.d/281.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/281.bugfix
front/src/components/audio/PlayButton.vue
+30
-21
30 additions, 21 deletions
front/src/components/audio/PlayButton.vue
with
31 additions
and
21 deletions
changes/changelog.d/281.bugfix
0 → 100644
+
1
−
0
View file @
7df783a7
Fix broken "play all" button that played only 25 tracks (#281)
This diff is collapsed.
Click to expand it.
front/src/components/audio/PlayButton.vue
+
30
−
21
View file @
7df783a7
...
...
@@ -67,8 +67,31 @@ export default {
}
},
methods
:
{
getTracksPage
(
page
,
params
,
resolve
,
tracks
)
{
if
(
page
>
10
)
{
// it's 10 * 100 tracks already, let's stop here
resolve
(
tracks
)
}
// when fetching artists/or album tracks, sometimes, we may have to fetch
// multiple pages
let
self
=
this
params
[
'
page_size
'
]
=
100
params
[
'
page
'
]
=
page
tracks
=
tracks
||
[]
axios
.
get
(
'
tracks/
'
,
{
params
:
params
}).
then
((
response
)
=>
{
response
.
data
.
results
.
forEach
(
t
=>
{
tracks
.
push
(
t
)
})
if
(
response
.
data
.
next
)
{
self
.
getTracksPage
(
page
+
1
,
params
,
resolve
,
tracks
)
}
else
{
resolve
(
tracks
)
}
})
},
getPlayableTracks
()
{
let
self
=
this
this
.
isLoading
=
true
let
getTracks
=
new
Promise
((
resolve
,
reject
)
=>
{
if
(
self
.
track
)
{
resolve
([
self
.
track
])
...
...
@@ -82,44 +105,30 @@ export default {
}))
})
}
else
if
(
self
.
artist
)
{
let
params
=
{
params
:
{
'
artist
'
:
self
.
artist
,
'
ordering
'
:
'
album__release_date,position
'
}
}
axios
.
get
(
'
tracks
'
,
params
).
then
((
response
)
=>
{
resolve
(
response
.
data
.
results
)
})
let
params
=
{
'
artist
'
:
self
.
artist
,
'
ordering
'
:
'
album__release_date,position
'
}
self
.
getTracksPage
(
1
,
params
,
resolve
)
}
else
if
(
self
.
album
)
{
let
params
=
{
params
:
{
'
album
'
:
self
.
album
,
'
ordering
'
:
'
position
'
}
}
axios
.
get
(
'
tracks
'
,
params
).
then
((
response
)
=>
{
resolve
(
response
.
data
.
results
)
})
let
params
=
{
'
album
'
:
self
.
album
,
'
ordering
'
:
'
position
'
}
self
.
getTracksPage
(
1
,
params
,
resolve
)
}
})
return
getTracks
.
then
((
tracks
)
=>
{
setTimeout
(
e
=>
{
self
.
isLoading
=
false
},
250
)
return
tracks
.
filter
(
e
=>
{
return
e
.
files
.
length
>
0
})
})
},
triggerLoad
()
{
let
self
=
this
this
.
isLoading
=
true
setTimeout
(()
=>
{
self
.
isLoading
=
false
},
500
)
},
add
()
{
let
self
=
this
this
.
triggerLoad
()
this
.
getPlayableTracks
().
then
((
tracks
)
=>
{
self
.
$store
.
dispatch
(
'
queue/appendMany
'
,
{
tracks
:
tracks
})
})
},
addNext
(
next
)
{
let
self
=
this
this
.
triggerLoad
()
let
wasEmpty
=
this
.
$store
.
state
.
queue
.
tracks
.
length
===
0
this
.
getPlayableTracks
().
then
((
tracks
)
=>
{
self
.
$store
.
dispatch
(
'
queue/appendMany
'
,
{
tracks
:
tracks
,
index
:
self
.
$store
.
state
.
queue
.
currentIndex
+
1
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment