Show a post button and fix selected logic for following/followers (#320)

This commit is contained in:
Tyler Kennedy 2022-12-29 23:31:34 -05:00 committed by GitHub
parent 9cea7bc124
commit 6a1caae79b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -80,8 +80,9 @@
{% if identity.local and identity.config_identity.visible_follows %}
<div class="view-options follows">
<a href="{{ identity.urls.following }}" {% if not inbound or not follows_page %}class="selected"{% endif %}><strong>{{ following_count }}</strong> following</a>
<a href="{{ identity.urls.followers }}" {% if inbound or not follows_page %}class="selected"{% endif %}><strong>{{ followers_count }}</strong> follower{{ followers_count|pluralize }}</a>
<a href="{{ identity.urls.view }}" {% if not follows_page %}class="selected"{% endif %}><strong>{{ post_count }}</strong> posts</a>
<a href="{{ identity.urls.following }}" {% if not inbound and follows_page %}class="selected"{% endif %}><strong>{{ following_count }}</strong> following</a>
<a href="{{ identity.urls.followers }}" {% if inbound and follows_page %}class="selected"{% endif %}><strong>{{ followers_count }}</strong> follower{{ followers_count|pluralize }}</a>
</div>
{% endif %}

View file

@ -74,6 +74,7 @@ class ViewIdentity(ListView):
context["page_obj"],
self.request.identity,
)
context["post_count"] = self.identity.posts.count()
if self.identity.config_identity.visible_follows:
context["followers_count"] = self.identity.inbound_follows.filter(
state__in=FollowStates.group_active()
@ -164,6 +165,7 @@ class IdentityFollows(ListView):
context["following_count"] = self.identity.outbound_follows.filter(
state__in=FollowStates.group_active()
).count()
context["post_count"] = self.identity.posts.count()
return context