Fix #812: Ensure correct track duration and playable status when browsing radios

merge-requests/757/head
Eliot Berriot 2019-05-02 10:17:55 +02:00
rodzic 0357342604
commit 8c04acd8e7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -5,6 +5,7 @@ from rest_framework.response import Response
from funkwhale_api.common import permissions as common_permissions
from funkwhale_api.music.serializers import TrackSerializer
from funkwhale_api.music import utils as music_utils
from funkwhale_api.users.oauth import permissions as oauth_permissions
from . import filters, filtersets, models, serializers
@ -47,7 +48,9 @@ class RadioViewSet(
def tracks(self, request, *args, **kwargs):
radio = self.get_object()
tracks = radio.get_candidates().for_nested_serialization()
actor = music_utils.get_actor_from_request(self.request)
tracks = tracks.with_playable_uploads(actor)
tracks = tracks.playable_by(actor)
page = self.paginate_queryset(tracks)
if page is not None:
serializer = TrackSerializer(page, many=True)
@ -110,7 +113,9 @@ class RadioSessionViewSet(
def get_serializer_context(self):
context = super().get_serializer_context()
context["user"] = self.request.user
context["user"] = (
self.request.user if self.request.user.is_authenticated else None
)
return context

Wyświetl plik

@ -0,0 +1 @@
Ensure correct track duration and playable status when browsing radios (#812)