mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 12:39:23 +02:00
API refinements for activity stream
This commit is contained in:
parent
d509c090d3
commit
a6da10be41
12 changed files with 188 additions and 12 deletions
|
@ -3,8 +3,9 @@ from rest_framework import status
|
|||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import detail_route
|
||||
|
||||
from funkwhale_api.music.serializers import TrackSerializerNested
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
from funkwhale_api.music.serializers import TrackSerializerNested
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
|
@ -17,6 +18,12 @@ class ListeningViewSet(mixins.CreateModelMixin,
|
|||
queryset = models.Listening.objects.all()
|
||||
permission_classes = [ConditionalAuthentication]
|
||||
|
||||
def perform_create(self, serializer):
|
||||
r = super().perform_create(serializer)
|
||||
if self.request.user.is_authenticated:
|
||||
record.send(serializer.instance)
|
||||
return r
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
if self.request.user.is_authenticated:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue