diff --git a/api/funkwhale_api/common/permissions.py b/api/funkwhale_api/common/permissions.py index 3f13b2005cafc3d9ffcd1f098b5d10e6f080e720..6b61d9839d5dd7c14eb4c495b912e35e440cb68c 100644 --- a/api/funkwhale_api/common/permissions.py +++ b/api/funkwhale_api/common/permissions.py @@ -7,5 +7,5 @@ class ConditionalAuthentication(BasePermission): def has_permission(self, request, view): if settings.API_AUTHENTICATION_REQUIRED: - return request.user and request.user.is_authenticated() + return request.user and request.user.is_authenticated return True diff --git a/api/funkwhale_api/history/views.py b/api/funkwhale_api/history/views.py index d65a70f8742ee958d728738dc1c9aa88c0c457c0..32bad6060273e53abad7de942c285b48b16c252e 100644 --- a/api/funkwhale_api/history/views.py +++ b/api/funkwhale_api/history/views.py @@ -22,14 +22,14 @@ class ListeningViewSet(mixins.CreateModelMixin, def get_queryset(self): queryset = super().get_queryset() - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: return queryset.filter(user=self.request.user) else: return queryset.filter(session_key=self.request.session.session_key) def get_serializer_context(self): context = super().get_serializer_context() - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: context['user'] = self.request.user else: context['session_key'] = self.request.session.session_key diff --git a/api/funkwhale_api/music/views.py b/api/funkwhale_api/music/views.py index 72982e4c5b916360e6f02d811507757c51dcb61a..1fd7aa974cb9a2ec8111f906bef4ec6d5d6d36dd 100644 --- a/api/funkwhale_api/music/views.py +++ b/api/funkwhale_api/music/views.py @@ -102,7 +102,7 @@ class TrackViewSet(TagViewSetMixin, SearchMixin, viewsets.ReadOnlyModelViewSet): queryset = super().get_queryset() filter_favorites = self.request.GET.get('favorites', None) user = self.request.user - if user.is_authenticated() and filter_favorites == 'true': + if user.is_authenticated and filter_favorites == 'true': queryset = queryset.filter(track_favorites__user=user) return queryset diff --git a/api/funkwhale_api/radios/views.py b/api/funkwhale_api/radios/views.py index 1ae788fcb0aad9c2d787f8f4862ff8bf3782d899..9243d6a90cc5c2ed7a8c420d2f1cc5cea5a9d41d 100644 --- a/api/funkwhale_api/radios/views.py +++ b/api/funkwhale_api/radios/views.py @@ -19,14 +19,14 @@ class RadioSessionViewSet(mixins.CreateModelMixin, def get_queryset(self): queryset = super().get_queryset() - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: return queryset.filter(user=self.request.user) else: return queryset.filter(session_key=self.request.session.session_key) def get_serializer_context(self): context = super().get_serializer_context() - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: context['user'] = self.request.user else: context['session_key'] = self.request.session.session_key @@ -44,7 +44,7 @@ class RadioSessionTrackViewSet(mixins.CreateModelMixin, serializer.is_valid(raise_exception=True) session = serializer.validated_data['session'] try: - if request.user.is_authenticated(): + if request.user.is_authenticated: assert request.user == session.user else: assert request.session.session_key == session.session_key