X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c15b511c1e9ebb06050f40e98ec554ba6c26cb1b..0c502550a4f04aa016df8729af2ae2f85c0b495a:/src/catalogue/api/fields.py?ds=inline diff --git a/src/catalogue/api/fields.py b/src/catalogue/api/fields.py index 48c00958a..d95c3a857 100644 --- a/src/catalogue/api/fields.py +++ b/src/catalogue/api/fields.py @@ -14,8 +14,10 @@ class BookLiked(serializers.ReadOnlyField): def to_representation(self, value): request = self.context['request'] if not hasattr(request, 'liked_books'): - if request.user.is_authenticated(): - request.liked_books = set(Book.tagged.with_any(request.user.tag_set.all()).values_list('id', flat=True)) + if request.user.is_authenticated: + request.liked_books = set( + Book.tagged.with_any(request.user.tag_set.all()).values_list('id', flat=True) + ) else: request.liked_books = None if request.liked_books is not None: @@ -25,7 +27,8 @@ class BookLiked(serializers.ReadOnlyField): class EmbargoURLField(AbsoluteURLField): def to_representation(self, value): request = self.context['request'] - if Membership.is_active_for(request.user): + # FIXME: See #3955. + if True or Membership.is_active_for(request.user): return super().to_representation(value) else: return None