Skip to content

Commit

Permalink
fix: Return NomComs, not Groups, from active_nomcoms filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed May 31, 2023
1 parent 3015359 commit e121b5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
17 changes: 8 additions & 9 deletions ietf/group/templatetags/group_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import debug # pyflakes:ignore

from ietf.group.models import Group
from ietf.nomcom.models import NomCom

register = template.Library()

Expand All @@ -19,14 +19,13 @@ def active_nomcoms(user):
if not (user and hasattr(user, "is_authenticated") and user.is_authenticated):
return []

groups = []

groups.extend(Group.objects.filter(
role__person__user=user,
type_id='nomcom',
state__slug='active').distinct().select_related("type"))

return groups
return list(
NomCom.objects.filter(
group__role__person__user=user,
group__type_id='nomcom', # just in case...
group__state__slug='active',
)
)

@register.inclusion_tag('person/person_link.html')
def role_person_link(role, **kwargs):
Expand Down
10 changes: 5 additions & 5 deletions ietf/templates/base/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,23 @@
</li>
{% endfor %}
{% endif %}
{% if user|active_nomcoms %}
{% with user|active_nomcoms as nomcoms %}{% if nomcoms %}
{% if flavor == 'top' %}
<li><hr class="dropdown-divider">
</li>
{% endif %}
<li {% if flavor == 'top' %}class="dropdown-header"{% else %}class="nav-item fw-bolder"{% endif %}>
NomComs
</li>
{% for g in user|active_nomcoms %}
{% for nomcom in nomcoms %}
<li>
<a class="dropdown-item {% if flavor != 'top' %}text-wrap link-primary{% endif %}"
href="{% url "ietf.nomcom.views.private_index" g.nomcom_set.first.year %}">
{{ g.acronym|capfirst }}
href="{% url "ietf.nomcom.views.private_index" nomcom.year %}">
{{ nomcom|capfirst }}
</a>
</li>
{% endfor %}
{% endif %}
{% endif %}{% endwith %}
{% endif %}
{% if flavor == 'top' %}
<li><hr class="dropdown-divider">
Expand Down

0 comments on commit e121b5d

Please sign in to comment.