fix: Use email or name when building community list view (#7203)
* fix: Use email or name when building community list view instead of email * test: add test case * chore: remove debug * fix: use name in community list menu when no active email is found --------- Co-authored-by: Jennifer Richards <jennifer@staff.ietf.org>
This commit is contained in:
parent
cc1eade4f8
commit
9d583ab9eb
|
@ -108,10 +108,8 @@ class CommunityListTests(TestCase):
|
|||
return [e for e in Email.objects.filter(person=person)] + \
|
||||
[a for a in Alias.objects.filter(person=person)]
|
||||
|
||||
def test_view_list(self):
|
||||
person = self.complex_person(user__username='plain')
|
||||
def do_view_list_test(self, person):
|
||||
draft = WgDraftFactory()
|
||||
|
||||
# without list
|
||||
for id in self.email_or_name_set(person):
|
||||
url = urlreverse(ietf.community.views.view_list, kwargs={ "email_or_name": id })
|
||||
|
@ -134,6 +132,15 @@ class CommunityListTests(TestCase):
|
|||
self.assertEqual(r.status_code, 200, msg=f"id='{id}', url='{url}'")
|
||||
self.assertContains(r, draft.name)
|
||||
|
||||
def test_view_list(self):
|
||||
person = self.complex_person(user__username='plain')
|
||||
self.do_view_list_test(person)
|
||||
|
||||
def test_view_list_without_active_email(self):
|
||||
person = self.complex_person(user__username='plain')
|
||||
person.email_set.update(active=False)
|
||||
self.do_view_list_test(person)
|
||||
|
||||
def test_manage_personal_list(self):
|
||||
person = self.complex_person(user__username='plain')
|
||||
ad = Person.objects.get(user__username='ad')
|
||||
|
|
|
@ -68,6 +68,7 @@ def view_list(request, email_or_name=None):
|
|||
'meta': meta,
|
||||
'can_manage_list': can_manage_community_list(request.user, clist),
|
||||
'subscribed': subscribed,
|
||||
"email_or_name": email_or_name,
|
||||
})
|
||||
|
||||
@login_required
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
<div class="btn-group" role="group" aria-labelledby="list-feeds">
|
||||
<a class="btn btn-primary"
|
||||
title="Feed of all changes"
|
||||
href="{% if clist.group %}{% url "ietf.community.views.feed" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.feed" email_or_name=clist.person.email_address %}{% endif %}">
|
||||
href="{% if clist.group %}{% url "ietf.community.views.feed" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.feed" email_or_name=email_or_name %}{% endif %}">
|
||||
<i class="bi bi-rss"></i> All changes
|
||||
</a>
|
||||
<a class="btn btn-primary"
|
||||
title="Feed of only significant state changes"
|
||||
href="{% if clist.group %}{% url "ietf.community.views.feed" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.feed" email_or_name=clist.person.email_address %}{% endif %}?significant=1">
|
||||
href="{% if clist.group %}{% url "ietf.community.views.feed" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.feed" email_or_name=email_or_name %}{% endif %}?significant=1">
|
||||
<i class="bi bi-rss"></i> Significant
|
||||
</a>
|
||||
</div>
|
||||
{% if clist.pk != None %}
|
||||
<a class="btn btn-primary"
|
||||
href="{% if clist.group %}{% url "ietf.community.views.subscription" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.subscription" email_or_name=clist.person.email_address %}{% endif %}">
|
||||
href="{% if clist.group %}{% url "ietf.community.views.subscription" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.subscription" email_or_name=email_or_name %}{% endif %}">
|
||||
<i class="bi bi-envelope"></i>
|
||||
{% if subscribed %}
|
||||
Change subscription
|
||||
|
@ -24,7 +24,7 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
<a class="btn btn-primary"
|
||||
href="{% if clist.group %}{% url "ietf.community.views.export_to_csv" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.export_to_csv" email_or_name=clist.person.email_address %}{% endif %}">
|
||||
href="{% if clist.group %}{% url "ietf.community.views.export_to_csv" acronym=clist.group.acronym %}{% else %}{% url "ietf.community.views.export_to_csv" email_or_name=email_or_name %}{% endif %}">
|
||||
<i class="bi bi-file-ruled"></i> Export as CSV
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{% bootstrap_messages %}
|
||||
{% if can_manage_list %}
|
||||
<a class="btn btn-primary my-3"
|
||||
href="{% url "ietf.community.views.manage_list" email_or_name=clist.person.email_address %}">
|
||||
href="{% url "ietf.community.views.manage_list" email_or_name=email_or_name %}">
|
||||
<i class="bi bi-gear"></i>
|
||||
Manage list
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue