summaryrefslogtreecommitdiffstats
path: root/users/views/identity.py
diff options
context:
space:
mode:
authorGabriel Rodríguez Alberich2022-12-14 18:15:46 +0100
committerGitHub2022-12-14 10:15:46 -0700
commitd1ce056288c97eea18e17f1b950194678618cefc (patch)
treef090c5da442348d7bf35a374cb4efc167e03d311 /users/views/identity.py
parent0d8b7db2729d94338824c748901637c625c103b0 (diff)
downloadtakahe-d1ce056288c97eea18e17f1b950194678618cefc.tar.gz
takahe-d1ce056288c97eea18e17f1b950194678618cefc.tar.bz2
takahe-d1ce056288c97eea18e17f1b950194678618cefc.zip
Show follows and following counts on profile page
And let their visibility be configured
Diffstat (limited to 'users/views/identity.py')
-rw-r--r--users/views/identity.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/users/views/identity.py b/users/views/identity.py
index b68806b..268b683 100644
--- a/users/views/identity.py
+++ b/users/views/identity.py
@@ -78,6 +78,13 @@ class ViewIdentity(ListView):
context["page_obj"],
self.request.identity,
)
+ if self.identity.config_identity.visible_follows:
+ context["followers_count"] = self.identity.inbound_follows.filter(
+ state__in=FollowStates.group_active()
+ ).count()
+ context["following_count"] = self.identity.outbound_follows.filter(
+ state__in=FollowStates.group_active()
+ ).count()
if self.request.identity:
follow = Follow.maybe_get(self.request.identity, self.identity)
if follow and follow.state in FollowStates.group_active():