diff --git a/app/community/routes.py b/app/community/routes.py index 9a6cfa87..da920891 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -439,6 +439,7 @@ def do_subscribe(actor, user_id, admin_preload=False): # for local communities, joining is instant member = CommunityMember(user_id=user.id, community_id=community.id) db.session.add(member) + community.subscriptions_count += 1 db.session.commit() if remote: # send ActivityPub message to remote community, asking to follow. Accept message will be sent to our shared inbox @@ -533,6 +534,7 @@ def unsubscribe(actor): if proceed: db.session.query(CommunityMember).filter_by(user_id=current_user.id, community_id=community.id).delete() db.session.query(CommunityJoinRequest).filter_by(user_id=current_user.id, community_id=community.id).delete() + community.subscriptions_count -= 1 db.session.commit() flash('You have left ' + community.title) diff --git a/app/templates/_side_pane.html b/app/templates/_side_pane.html index 8c0d424e..a24b0f6b 100644 --- a/app/templates/_side_pane.html +++ b/app/templates/_side_pane.html @@ -34,6 +34,10 @@
{{ community.description_html|community_links|safe if community.description_html else '' }}
{{ community.rules_html|safe if community.rules_html else '' }}
+{{ _('Subscribers') }}: {{ community.subscriptions_count }}
+ {{ _('Posts') }}: {{ community.post_count }}
+ {{ _('Comments') }}: {{ community.post_reply_count }}
+