diff --git a/ietf/doc/migrations/0023_bofreqspamstate.py b/ietf/doc/migrations/0023_bofreqspamstate.py new file mode 100644 index 0000000000..dbbaf996e9 --- /dev/null +++ b/ietf/doc/migrations/0023_bofreqspamstate.py @@ -0,0 +1,30 @@ +# Copyright The IETF Trust 2024, All Rights Reserved + +from django.db import migrations + + +def forward(apps, schema_editor): + State = apps.get_model("doc", "State") + State.objects.get_or_create( + type_id="bofreq", + slug="spam", + defaults={"name": "Spam", "desc": "The BOF request is spam", "order": 5}, + ) + + +def reverse(apps, schema_editor): + State = apps.get_model("doc", "State") + Document = apps.get_model("doc", "Document") + assert not Document.objects.filter( + states__type="bofreq", states__slug="spam" + ).exists() + State.objects.filter(type_id="bofreq", slug="spam").delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ("doc", "0022_remove_dochistory_internal_comments_and_more"), + ] + + operations = [migrations.RunPython(forward, reverse)] diff --git a/ietf/doc/tests_bofreq.py b/ietf/doc/tests_bofreq.py index 319ab778d6..2e27efd627 100644 --- a/ietf/doc/tests_bofreq.py +++ b/ietf/doc/tests_bofreq.py @@ -54,8 +54,8 @@ def test_show_bof_requests(self): self.assertEqual(r.status_code, 200) q = PyQuery(r.content) for state in states: - self.assertEqual(len(q(f'#bofreqs-{state.slug}')), 1) - self.assertEqual(len(q(f'#bofreqs-{state.slug} tbody tr')), 3) + self.assertEqual(len(q(f'#bofreqs-{state.slug}')), 1 if state.slug!="spam" else 0) + self.assertEqual(len(q(f'#bofreqs-{state.slug} tbody tr')), 3 if state.slug!="spam" else 0) self.assertFalse(q('#start_button')) PersonFactory(user__username='nobody') self.client.login(username='nobody', password='nobody+password') @@ -63,6 +63,13 @@ def test_show_bof_requests(self): self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertTrue(q('#start_button')) + self.client.logout() + self.client.login(username='secretary', password='secretary+password') + r = self.client.get(url) + q = PyQuery(r.content) + for state in states: + self.assertEqual(len(q(f'#bofreqs-{state.slug}')), 1) + self.assertEqual(len(q(f'#bofreqs-{state.slug} tbody tr')), 3) def test_bofreq_main_page(self): diff --git a/ietf/name/fixtures/names.json b/ietf/name/fixtures/names.json index 59b367deb8..401767657d 100644 --- a/ietf/name/fixtures/names.json +++ b/ietf/name/fixtures/names.json @@ -2617,6 +2617,19 @@ "model": "doc.state", "pk": 180 }, + { + "fields": { + "desc": "The BOF request is spam", + "name": "Spam", + "next_states": [], + "order": 5, + "slug": "spam", + "type": "bofreq", + "used": true + }, + "model": "doc.state", + "pk": 182 + }, { "fields": { "label": "State" diff --git a/ietf/templates/doc/bofreq/bof_requests.html b/ietf/templates/doc/bofreq/bof_requests.html index 2a806b18a5..19c2e5dd13 100644 --- a/ietf/templates/doc/bofreq/bof_requests.html +++ b/ietf/templates/doc/bofreq/bof_requests.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {# Copyright The IETF Trust 2021 All Rights Reserved #} {% load origin %} -{% load person_filters %} +{% load person_filters ietf_filters %} {% load static %} {% block pagehead %} @@ -26,40 +26,42 @@

BOF Requests

{% else %} {% regroup reqs by get_state_slug as grouped_reqs %} {% for req_group in grouped_reqs %} -

{{ req_group.grouper|capfirst }} BOF Requests

- - - - - - - - - - - - {% for req in req_group.list %} + {% if req_group.grouper != "spam" or request.user|has_role:"Secretariat" %} +

{{ req_group.grouper|capfirst }} BOF Requests

+
NameDateTitleResponsibleEditors
+ - - - - - + + + + + - {% endfor %} - -
- {{ req.name }}-{{ req.rev }} - {{ req.latest_revision_event.time|date:"Y-m-d" }}{{ req.title }} - {% for person in req.responsible %} - {% person_link person %}{% if not forloop.last %},{% endif %} - {% endfor %} - - {% for person in req.editors %} - {% person_link person %}{% if not forloop.last %},{% endif %} - {% endfor %} - NameDateTitleResponsibleEditors
+ + + {% for req in req_group.list %} + + + {{ req.name }}-{{ req.rev }} + + {{ req.latest_revision_event.time|date:"Y-m-d" }} + {{ req.title }} + + {% for person in req.responsible %} + {% person_link person %}{% if not forloop.last %},{% endif %} + {% endfor %} + + + {% for person in req.editors %} + {% person_link person %}{% if not forloop.last %},{% endif %} + {% endfor %} + + + {% endfor %} + + + {% endif %} {% endfor %} {% endif %} {% endblock %}