mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 21:19:15 +02:00
Use our instance policies to discard fetched and inbox objects
This commit is contained in:
parent
9151a185e0
commit
1c55f2c9a6
15 changed files with 317 additions and 31 deletions
|
@ -13,6 +13,7 @@ from funkwhale_api.music import models as music_models
|
|||
|
||||
from . import activity
|
||||
from . import api_serializers
|
||||
from . import exceptions
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import routes
|
||||
|
@ -128,11 +129,16 @@ class LibraryViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
|
|||
except KeyError:
|
||||
return response.Response({"fid": ["This field is required"]})
|
||||
try:
|
||||
library = utils.retrieve(
|
||||
library = utils.retrieve_ap_object(
|
||||
fid,
|
||||
queryset=self.queryset,
|
||||
serializer_class=serializers.LibrarySerializer,
|
||||
)
|
||||
except exceptions.BlockedActorOrDomain:
|
||||
return response.Response(
|
||||
{"detail": "This domain/account is blocked on your instance."},
|
||||
status=400,
|
||||
)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return response.Response(
|
||||
{"detail": "Error while fetching the library: {}".format(str(e))},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue