Ensure follower is approved for listening

This commit is contained in:
Eliot Berriot 2018-04-14 18:37:10 +02:00
parent 74f5907156
commit ca02aca327
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
2 changed files with 22 additions and 2 deletions

View file

@ -3,6 +3,7 @@ from django.conf import settings
from rest_framework.permissions import BasePermission
from funkwhale_api.federation import actors
from funkwhale_api.federation import models
class Listen(BasePermission):
@ -20,4 +21,8 @@ class Listen(BasePermission):
return False
library = actors.SYSTEM_ACTORS['library'].get_actor_instance()
return library.followers.filter(url=actor.url).exists()
return models.Follow.objects.filter(
target=library,
actor=actor,
approved=True
).exists()