mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 03:29:23 +02:00
Ensure follower is approved for listening
This commit is contained in:
parent
74f5907156
commit
ca02aca327
2 changed files with 22 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue