From d1ce056288c97eea18e17f1b950194678618cefc Mon Sep 17 00:00:00 2001 From: Gabriel Rodríguez Alberich Date: Wed, 14 Dec 2022 18:15:46 +0100 Subject: Show follows and following counts on profile page And let their visibility be configured--- users/views/identity.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'users/views/identity.py') 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(): -- cgit v1.2.3