Skip to content

Commit

Permalink
Show a post button and fix selected logic for following/followers (jo…
Browse files Browse the repository at this point in the history
  • Loading branch information
TkTech authored Dec 30, 2022
1 parent 9cea7bc commit 6a1caae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions templates/identity/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ <h1 class="identity">

{% 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 %}

Expand Down
2 changes: 2 additions & 0 deletions users/views/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def get_context_data(self):
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()
Expand Down Expand Up @@ -164,6 +165,7 @@ def get_context_data(self):
context["following_count"] = self.identity.outbound_follows.filter(
state__in=FollowStates.group_active()
).count()
context["post_count"] = self.identity.posts.count()
return context


Expand Down

0 comments on commit 6a1caae

Please sign in to comment.