diff --git a/bookwyrm/templates/user/user_preview.html b/bookwyrm/templates/user/user_preview.html index 89b545cec..c450365bb 100644 --- a/bookwyrm/templates/user/user_preview.html +++ b/bookwyrm/templates/user/user_preview.html @@ -18,7 +18,7 @@ {% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}, {% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %} - {% else %} + {% elif request.user.is_authenticated %} {% mutuals_count user as mutuals %} diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 2697d3ced..eda3d1023 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -241,4 +241,6 @@ def get_lang(): def mutuals_count(context, user): """how many users that you follow, follow them""" viewer = context["request"].user + if not viewer.is_authenticated: + return None return user.followers.filter(id__in=viewer.following.all()).count()