mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 16:40:36 +00:00
Don't calculate mutuals for logged out users
This commit is contained in:
parent
ca12359bee
commit
b8fc4f99a3
2 changed files with 3 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
|||
<a href="{% url 'user-followers' user|username %}">{% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}</a>,
|
||||
<a href="{% url 'user-following' user|username %}">{% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %}</a>
|
||||
|
||||
{% else %}
|
||||
{% elif request.user.is_authenticated %}
|
||||
|
||||
{% mutuals_count user as mutuals %}
|
||||
<a href="{% url 'user-followers' user|username %}">
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue