diff --git a/ietf/nomcom/tests.py b/ietf/nomcom/tests.py index 22c67be43..263551f17 100644 --- a/ietf/nomcom/tests.py +++ b/ietf/nomcom/tests.py @@ -1489,7 +1489,10 @@ class NewActiveNomComTests(TestCase): def setUp(self): super().setUp() setup_test_public_keys_dir(self) - self.nc = NomComFactory.create(**nomcom_kwargs_for_year(year=random.randint(1992,2100))) + # Pin nomcom years to be after 2008 or later so that ietf.nomcom.utils.list_eligible can + # return something other than empty. Note that anything after 2022 is suspect, and that + # we should revisit this when implementing RFC 9389. + self.nc = NomComFactory.create(**nomcom_kwargs_for_year(year=random.randint(2008,2100))) self.chair = self.nc.group.role_set.filter(name='chair').first().person self.saved_days_to_expire_nomination_link = settings.DAYS_TO_EXPIRE_NOMINATION_LINK @@ -1929,7 +1932,7 @@ Junk body for testing for number in range(meeting_start, meeting_start+8): m = MeetingFactory.create(type_id='ietf', number=number) for p in people: - m.meetingregistration_set.create(person=p) + m.meetingregistration_set.create(person=p, reg_type="onsite", checkedin=True, attended=True) for p in people: self.nc.volunteer_set.create(person=p,affiliation='something') for view in ('public_volunteers','private_volunteers'): @@ -1947,6 +1950,14 @@ Junk body for testing login_testing_unauthorized(self,self.chair.user.username,url) response = self.client.get(url) self.assertContains(response,people[-1].email(),status_code=200) + unqualified_person = PersonFactory() + url = reverse('ietf.nomcom.views.qualified_volunteer_list_for_announcement',kwargs={'year':year}) + self.client.logout() + login_testing_unauthorized(self,self.chair.user.username,url) + response = self.client.get(url) + self.assertContains(response, people[-1].plain_name(), status_code=200) + self.assertNotContains(response, unqualified_person.plain_name()) + diff --git a/ietf/nomcom/urls.py b/ietf/nomcom/urls.py index f7a19e222..10b1a2937 100644 --- a/ietf/nomcom/urls.py +++ b/ietf/nomcom/urls.py @@ -41,6 +41,7 @@ urlpatterns = [ url(r'^(?P\d{4})/private/chair/eligible/$', views.private_eligible), url(r'^(?P\d{4})/private/chair/volunteers/$', views.private_volunteers), url(r'^(?P\d{4})/private/chair/volunteers/csv/$', views.private_volunteers_csv), + url(r'^(?P\d{4})/private/chair/volunteers/announce-list/$', views.qualified_volunteer_list_for_announcement), url(r'^(?P\d{4})/$', views.year_index), url(r'^(?P\d{4})/requirements/$', views.requirements), diff --git a/ietf/nomcom/views.py b/ietf/nomcom/views.py index 6f02b16e2..d862b3a40 100644 --- a/ietf/nomcom/views.py +++ b/ietf/nomcom/views.py @@ -1333,3 +1333,12 @@ def private_volunteers_csv(request, year, public=False): writer.writerow([v.person.last_name(), v.person.first_name(), v.person.ascii_name(), v.affiliation, v.person.email(), v.qualifications, v.eligible]) return response +@role_required("Nomcom Chair", "Nomcom Advisor", "Secretariat") +def qualified_volunteer_list_for_announcement(request, year, public=False): + _, volunteers = extract_volunteers(year) + qualified_volunteers = [v for v in volunteers if v.eligible] + return render(request, 'nomcom/qualified_volunteer_list_for_announcement.txt', + dict(volunteers=qualified_volunteers), + content_type="text/plain; charset=%s"%settings.DEFAULT_CHARSET) + + diff --git a/ietf/templates/nomcom/qualified_volunteer_list_for_announcement.txt b/ietf/templates/nomcom/qualified_volunteer_list_for_announcement.txt new file mode 100644 index 000000000..46fae1e06 --- /dev/null +++ b/ietf/templates/nomcom/qualified_volunteer_list_for_announcement.txt @@ -0,0 +1,4 @@ +{% load ietf_filters %}{% autoescape off %}Name Affiliation + +{% for volunteer in volunteers %}{{ volunteer.person.plain_name|ljust:"25" }}{{ volunteer.affiliation|default:"No affiliation provided" }} +{% endfor %}{% endautoescape %}