better logic for identifying group manager

This commit is contained in:
Hugh Rundle 2021-09-25 20:23:59 +10:00
parent 62a5ed7a9e
commit 035fc5209d
2 changed files with 5 additions and 14 deletions

View file

@ -38,6 +38,11 @@
<span title="{{ member.display_name }}" class="is-block is-6 has-text-weight-bold">{{ member.display_name|truncatechars:10 }}</span>
<span title="@{{ member|username }}" class="is-block pb-3">@{{ member|username|truncatechars:8 }}</span>
</a>
{% if group.manager == member %}
<span class="icon icon-star-full" title="Manager">
<span class="is-sr-only">Manager</span>
</span>
{% endif %}
{% include 'snippets/add_to_group_button.html' with user=member minimal=True %}
{% if member.mutuals %}
<p class="help">
@ -59,7 +64,6 @@
{% trans "Follows you" %}
</p>
{% endif %}
{% identify_manager %}
</div>
{% endfor %}
</div>

View file

@ -1,7 +1,6 @@
""" template filters """
from django import template
from django.db.models import Avg
from django.utils.safestring import mark_safe
from bookwyrm import models, views
@ -99,15 +98,3 @@ def mutuals_count(context, user):
if not viewer.is_authenticated:
return None
return user.followers.filter(followers=viewer).count()
@register.simple_tag(takes_context=True)
def identify_manager(context):
"""boolean for whether user is group manager"""
group = context['group']
member = context['member']
snippet = mark_safe('')
if group.manager == member:
snippet = mark_safe('<span class="icon icon-star-full" title="Manager"><span class="is-sr-only">Manager</span></span>')
return snippet