{% if request.user.is_authenticated %}
- {% if user_statuses.review_count or user_statuses.comment_count or user_stuatses.quotation_count %}
+ {% if user_statuses.review_count or user_statuses.comment_count or user_statuses.quotation_count %}
{% endfor %}
+ {% if ratings %}
{% for rating in ratings %}
{% with user=rating.user %}
@@ -265,6 +266,7 @@
{% endwith %}
{% endfor %}
+ {% endif %}
{% include 'snippets/pagination.html' with page=statuses path=request.path anchor="#reviews" %}
diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py
index 6005c9fd..27bdddb1 100644
--- a/bookwyrm/views/books.py
+++ b/bookwyrm/views/books.py
@@ -30,6 +30,7 @@ class Book(View):
def get(self, request, book_id, user_statuses=False):
"""info about a book"""
+ user_statuses = user_statuses if request.user.is_authenticated else False
try:
book = models.Book.objects.select_subclasses().get(id=book_id)
except models.Book.DoesNotExist:
@@ -51,7 +52,7 @@ class Book(View):
)
# the reviews to show
- if user_statuses and request.user.is_authenticated:
+ if user_statuses:
if user_statuses == "review":
queryset = book.review_set
elif user_statuses == "comment":
@@ -67,7 +68,9 @@ class Book(View):
"book": book,
"statuses": paginated.get_page(request.GET.get("page")),
"review_count": reviews.count(),
- "ratings": reviews.filter(Q(content__isnull=True) | Q(content="")),
+ "ratings": reviews.filter(Q(content__isnull=True) | Q(content=""))
+ if not user_statuses
+ else None,
"rating": reviews.aggregate(Avg("rating"))["rating__avg"],
"lists": privacy_filter(
request.user, book.list_set.filter(listitem__approved=True)