Skip to content
Snippets Groups Projects
Commit 806912c0 authored by Agate's avatar Agate :speech_balloon:
Browse files

Merge branch '1140-the-radio-random-function-also-plays-podcasts' into 'develop'

Resolve "The "radio - random" function also plays podcasts"

Closes #1140

See merge request funkwhale/funkwhale!1176
parents b62e5d9f 71318d66
Branches
Tags
No related merge requests found
......@@ -102,7 +102,7 @@ class SessionRadio(SimpleRadio):
class RandomRadio(SessionRadio):
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
return qs.order_by("?")
return qs.filter(artist__content_category="music").order_by("?")
@registry.register(name="favorites")
......@@ -116,7 +116,7 @@ class FavoritesRadio(SessionRadio):
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
track_ids = kwargs["user"].track_favorites.all().values_list("track", flat=True)
return qs.filter(pk__in=track_ids)
return qs.filter(pk__in=track_ids, artist__content_category="music")
@registry.register(name="custom")
......@@ -271,7 +271,11 @@ class LessListenedRadio(SessionRadio):
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
listened = self.session.user.listenings.all().values_list("track", flat=True)
return qs.exclude(pk__in=listened).order_by("?")
return (
qs.filter(artist__content_category="music")
.exclude(pk__in=listened)
.order_by("?")
)
@registry.register(name="actor_content")
......
Fix random radio so that podcast content is not picked up (#1140)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment