Blacked the code

This commit is contained in:
Eliot Berriot 2018-06-09 15:36:16 +02:00
parent b6fc0051fa
commit 62ca3bd736
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
279 changed files with 8861 additions and 9527 deletions

View file

@ -8,22 +8,19 @@ from funkwhale_api.federation import models
class Listen(BasePermission):
def has_permission(self, request, view):
if not preferences.get('common__api_authentication_required'):
if not preferences.get("common__api_authentication_required"):
return True
user = getattr(request, 'user', None)
user = getattr(request, "user", None)
if user and user.is_authenticated:
return True
actor = getattr(request, 'actor', None)
actor = getattr(request, "actor", None)
if actor is None:
return False
library = actors.SYSTEM_ACTORS['library'].get_actor_instance()
library = actors.SYSTEM_ACTORS["library"].get_actor_instance()
return models.Follow.objects.filter(
target=library,
actor=actor,
approved=True
target=library, actor=actor, approved=True
).exists()