Merge branch 'master' into develop
This commit is contained in:
commit
0c9af964fe
|
@ -1,3 +1,5 @@
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
from django_filters import rest_framework as filters
|
from django_filters import rest_framework as filters
|
||||||
|
|
||||||
from funkwhale_api.audio import filters as audio_filters
|
from funkwhale_api.audio import filters as audio_filters
|
||||||
|
@ -112,6 +114,9 @@ class TrackFilter(
|
||||||
scope = common_filters.ActorScopeFilter(
|
scope = common_filters.ActorScopeFilter(
|
||||||
actor_field="uploads__library__actor", distinct=True
|
actor_field="uploads__library__actor", distinct=True
|
||||||
)
|
)
|
||||||
|
artist = filters.ModelChoiceFilter(
|
||||||
|
field_name="_", method="filter_artist", queryset=models.Artist.objects.all()
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Track
|
model = models.Track
|
||||||
|
@ -119,7 +124,6 @@ class TrackFilter(
|
||||||
"title": ["exact", "iexact", "startswith", "icontains"],
|
"title": ["exact", "iexact", "startswith", "icontains"],
|
||||||
"playable": ["exact"],
|
"playable": ["exact"],
|
||||||
"id": ["exact"],
|
"id": ["exact"],
|
||||||
"artist": ["exact"],
|
|
||||||
"album": ["exact"],
|
"album": ["exact"],
|
||||||
"license": ["exact"],
|
"license": ["exact"],
|
||||||
"scope": ["exact"],
|
"scope": ["exact"],
|
||||||
|
@ -134,6 +138,9 @@ class TrackFilter(
|
||||||
actor = utils.get_actor_from_request(self.request)
|
actor = utils.get_actor_from_request(self.request)
|
||||||
return queryset.playable_by(actor, value).distinct()
|
return queryset.playable_by(actor, value).distinct()
|
||||||
|
|
||||||
|
def filter_artist(self, queryset, name, value):
|
||||||
|
return queryset.filter(Q(artist=value) | Q(album__artist=value))
|
||||||
|
|
||||||
|
|
||||||
class UploadFilter(audio_filters.IncludeChannelsFilterSet):
|
class UploadFilter(audio_filters.IncludeChannelsFilterSet):
|
||||||
library = filters.CharFilter("library__uuid")
|
library = filters.CharFilter("library__uuid")
|
||||||
|
|
|
@ -184,3 +184,22 @@ def test_library_filter_artist(factories, queryset_equal_list, mocker, anonymous
|
||||||
)
|
)
|
||||||
|
|
||||||
assert filterset.qs == [upload.track.artist]
|
assert filterset.qs == [upload.track.artist]
|
||||||
|
|
||||||
|
|
||||||
|
def test_track_filter_artist_includes_album_artist(
|
||||||
|
factories, mocker, queryset_equal_list, anonymous_user
|
||||||
|
):
|
||||||
|
factories["music.Track"]()
|
||||||
|
track1 = factories["music.Track"]()
|
||||||
|
track2 = factories["music.Track"](
|
||||||
|
album__artist=track1.artist, artist=factories["music.Artist"]()
|
||||||
|
)
|
||||||
|
|
||||||
|
qs = models.Track.objects.all()
|
||||||
|
filterset = filters.TrackFilter(
|
||||||
|
{"artist": track1.artist.pk},
|
||||||
|
request=mocker.Mock(user=anonymous_user),
|
||||||
|
queryset=qs,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert filterset.qs == [track2, track1]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Include tracks by album artist when filtering by artist on /api/v1/tracks (#1078)
|
|
@ -0,0 +1 @@
|
||||||
|
Ensure player doesn't disappear when last queue track is removed manually (#1092)
|
|
@ -20,7 +20,7 @@ If you have the channel's full social network name:
|
||||||
URL to the channel
|
URL to the channel
|
||||||
- Click "Subscribe"
|
- Click "Subscribe"
|
||||||
|
|
||||||
Following Funwkhale Channels Through the Fediverse
|
Following Funkwhale Channels Through the Fediverse
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
Funkwhale channels can be followed from different ActivityPub-enabled applications
|
Funkwhale channels can be followed from different ActivityPub-enabled applications
|
||||||
|
|
|
@ -104,8 +104,13 @@ export default {
|
||||||
commit('splice', {start: index, size: 1})
|
commit('splice', {start: index, size: 1})
|
||||||
if (index < state.currentIndex) {
|
if (index < state.currentIndex) {
|
||||||
commit('currentIndex', state.currentIndex - 1)
|
commit('currentIndex', state.currentIndex - 1)
|
||||||
}
|
} else if (index > 0 && index === state.tracks.length) {
|
||||||
if (current) {
|
// kind of a edge case: if you delete the last track of the queue
|
||||||
|
// we set current index to the previous one to avoid the queue tab from
|
||||||
|
// being stuck because the player disappeared
|
||||||
|
// cf #1092
|
||||||
|
commit('currentIndex', state.tracks.length - 1)
|
||||||
|
} else if (current) {
|
||||||
// we play next track, which now have the same index
|
// we play next track, which now have the same index
|
||||||
commit('currentIndex', index)
|
commit('currentIndex', index)
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ describe('store/queue', () => {
|
||||||
testAction({
|
testAction({
|
||||||
action: store.actions.cleanTrack,
|
action: store.actions.cleanTrack,
|
||||||
payload: 3,
|
payload: 3,
|
||||||
params: {state: {currentIndex: 2, tracks: []}},
|
params: {state: {currentIndex: 2, tracks: [1, 2, 3, 4, 5]}},
|
||||||
expectedMutations: [
|
expectedMutations: [
|
||||||
{ type: 'splice', payload: {start: 3, size: 1} }
|
{ type: 'splice', payload: {start: 3, size: 1} }
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue